Re: [PATCHSET cgroup/for-3.8] cgroup_freezer: implement proper hierarchy support
On Sat, Nov 03, 2012 at 01:38:26AM -0700, Tejun Heo wrote: git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cgroup_freezer-hierarchy Updated patches posted as replies to the original patches and the above git branch updated with the updated patches. As all the updates are minor, I won't re-post the whole series. Thanks. -- tejun -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/9 v3] cgroup_freezer: implement proper hierarchy support
On Thu 08-11-12 09:57:50, Tejun Heo wrote: Up until now, cgroup_freezer didn't implement hierarchy properly. cgroups could be arranged in hierarchy but it didn't make any difference in how each cgroup_freezer behaved. They all operated separately. This patch implements proper hierarchy support. If a cgroup is frozen, all its descendants are frozen. A cgroup is thawed iff it and all its ancestors are THAWED. freezer.self_freezing shows the current freezing state for the cgroup itself. freezer.parent_freezing shows whether the cgroup is freezing because any of its ancestors is freezing. freezer_post_create() locks the parent and new cgroup and inherits the parent's state and freezer_change_state() applies new state top-down using cgroup_for_each_descendant_pre() which guarantees that no child can escape its parent's state. update_if_frozen() uses cgroup_for_each_descendant_post() to propagate frozen states bottom-up. Synchronization could be coarser and easier by using a single mutex to protect all hierarchy operations. Finer grained approach was used because it wasn't too difficult for cgroup_freezer and I think it's beneficial to have an example implementation and cgroup_freezer is rather simple and can serve a good one. As this makes cgroup_freezer properly hierarchical, freezer_subsys.broken_hierarchy marking is removed. Note that this patch changes userland visible behavior - freezing a cgroup now freezes all its descendants too. This behavior change is intended and has been warned via .broken_hierarchy. v2: Michal spotted a bug in freezer_change_state() - descendants were inheriting from the wrong ancestor. Fixed. v3: Documentation/cgroups/freezer-subsystem.txt updated. Signed-off-by: Tejun Heo t...@kernel.org Reviewed-by: Tejun Heo t...@kernel.org You probably meant Reviewed-by: Michal Hocko ;) -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 0/8][Sorted-buddy] mm: Linux VM Infrastructure to support Memory Power Management
On Wed, Nov 07, 2012 at 01:22:13AM +0530, Srivatsa S. Bhat wrote: Today memory subsystems are offer a wide range of capabilities for managing memory power consumption. As a quick example, if a block of memory is not referenced for a threshold amount of time, the memory controller can decide to put that chunk into a low-power content-preserving state. And the next reference to that memory chunk would bring it back to full power for read/write. With this capability in place, it becomes important for the OS to understand the boundaries of such power-manageable chunks of memory and to ensure that references are consolidated to a minimum number of such memory power management domains. How much power is saved? ACPI 5.0 has introduced MPST tables (Memory Power State Tables) [5] so that the firmware can expose information regarding the boundaries of such memory power management domains to the OS in a standard way. I'm not familiar with the ACPI spec but is there support for parsing of MPST and interpreting the associated ACPI events? For example, if ACPI fires an event indicating that a memory power node is to enter a low state then presumably the OS should actively migrate pages away -- even if it's going into a state where the contents are still refreshed as exiting that state could take a long time. I did not look closely at the patchset at all because it looked like the actual support to use it and measure the benefit is missing. How can Linux VM help memory power savings? o Consolidate memory allocations and/or references such that they are not spread across the entire memory address space. Basically area of memory that is not being referenced, can reside in low power state. Which the series does not appear to do. o Support targeted memory reclaim, where certain areas of memory that can be easily freed can be offlined, allowing those areas of memory to be put into lower power states. Which the series does not appear to do judging from this; include/linux/mm.h | 38 +++ include/linux/mmzone.h | 52 + mm/compaction.c|8 + mm/page_alloc.c| 263 mm/vmstat.c| 59 ++- This does not appear to be doing anything with reclaim and not enough with compaction to indicate that the series actively manages memory placement in response to ACPI events. Further in section 5.2.21.4 the spec says that power node regions can overlap (but are not hierarchal for some reason) but have no gaps yet the structure you use to represent is assumes there can be gaps and there are no overlaps. Again, this is just glancing at the spec and a quick skim of the patches so maybe I missed something that explains why this structure is suitable. It seems to me that superficially the VM implementation for the support would have a) Involved a tree that managed the overlapping regions (even if it's not hierarchal it feels more sensible) and picked the highest-power-state common denominator in the tree. This would only be allocated if support for MPST is available. b) Leave memory allocations and reclaim as they are in the active state. c) Use a sticky migrate list MIGRATE_LOWPOWER for regions that are in lower power but still usable with a latency penalty. This might be a single migrate type but could also be a parallel set of free_area called free_area_lowpower that is only used when free_area is depleted and in the very slow path of the allocator. d) Use memory hot-remove for power states where the refresh rates were not constant and only did anything expensive in response to an ACPI event -- none of the fast paths should be touched. When transitioning to the low power state, memory should be migrated in a vaguely similar fashion to what CMA does. For low-power, migration failure is acceptable. If contents are not preserved, ACPI needs to know if the migration failed because it cannot enter that power state. For any of this to be worthwhile, low power states would need to be achieved for long periods of time because that migration is not free. Memory Regions: --- Memory Regions is a way of capturing the boundaries of power-managable chunks of memory, within the MM subsystem. Short description of the Sorted-buddy design: --- In this design, the memory region boundaries are captured in a parallel data-structure instead of fitting regions between nodes and zones in the hierarchy. Further, the buddy allocator is altered, such that we maintain the zones' freelists in region-sorted-order and thus do page allocation in the order of increasing memory regions. Implying that this sorting has to happen in the either the alloc or free fast path. (The freelists need not be fully address-sorted, they just need to be region-sorted. Patch
Re: [PATCH 9/9 v3] cgroup_freezer: implement proper hierarchy support
On Thu, Nov 08, 2012 at 07:02:46PM +0100, Michal Hocko wrote: On Thu 08-11-12 09:57:50, Tejun Heo wrote: Signed-off-by: Tejun Heo t...@kernel.org Reviewed-by: Tejun Heo t...@kernel.org You probably meant Reviewed-by: Michal Hocko ;) Hehehheheh... man, I'm too self-absolved. Thanks for noticing that. :) Updated. -- tejun -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Wed, Nov 7, 2012 at 9:58 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: On Tue, Nov 06, 2012 at 11:36:08PM +0100, Rafael J. Wysocki wrote: OK, but then we need to pass the information obtained from _CRS (presumably after some adjustments through _SRS) to drivers, or rather to things like the SPI core, I2C core etc. so that they can create device objects for drivers to bind to and quite frankly I don't see why not to use ACPI resources for that. Nevertheless, the routines for parsing those resources should belong to the ACPI core, mostly to avoid code duplication. Rafael, So is the idea now that the ACPI core parses the resources and passes them forward via struct acpi_device? I'm just wondering how to proceed with these I2C and SPI enumeration patches. From my experience with device tree, that seems the wrong way around. Device Tree used to have a separate of_device which is analogous to an acpi_device. The problem was always that of_devices never fit into the view that Linux has of the system. That would mean having both an of_device and and spi_device in completely separate parts of the driver model tree to support an spi device. Same for platform, i2c and onewire and others. Blech. So, yes I agree that ACPI core should have the tools for parsing the resources, but it makes sense for those functions to be helpers that the spi core acpi support and the i2c core acpi support use to populate the native spi_device and i2c_client structures. Plus individual drivers can call the same functions if (and only if) the needed resources cannot fit into the bus type's native format. We really could also use more common code between bus types for storing various kinds of resources, but that's a separate issue and doesn't affect this discussion. g. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/9 v3] cgroup_freezer: implement proper hierarchy support
On Thu 08-11-12 10:04:17, Tejun Heo wrote: On Thu, Nov 08, 2012 at 07:02:46PM +0100, Michal Hocko wrote: On Thu 08-11-12 09:57:50, Tejun Heo wrote: Signed-off-by: Tejun Heo t...@kernel.org Reviewed-by: Tejun Heo t...@kernel.org You probably meant Reviewed-by: Michal Hocko ;) Hehehheheh... man, I'm too self-absolved. Thanks for noticing that. :) Updated. Heh, btw. the doc update looks good as well. -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] smack: SMACK_MAGIC to include/uapi/linux/magic.h
SMACK_MAGIC moved to a proper place for easy user space access (i.e. libsmack). Signed-off-by: Jarkko Sakkinen jarkko.sakki...@iki.fi --- include/uapi/linux/magic.h |1 + security/smack/smack.h |6 +- security/smack/smack_lsm.c |1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index e15192c..12735ad 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -11,6 +11,7 @@ #define DEBUGFS_MAGIC 0x64626720 #define SECURITYFS_MAGIC 0x73636673 #define SELINUX_MAGIC 0xf97cff8c +#define SMACK_MAGIC0x43415d53 /* SMAC */ #define RAMFS_MAGIC0x858458f6 /* some random number */ #define TMPFS_MAGIC0x01021994 #define HUGETLBFS_MAGIC0x958458f6 /* some random number */ diff --git a/security/smack/smack.h b/security/smack/smack.h index 99b3612..e3e7a4f 100644 --- a/security/smack/smack.h +++ b/security/smack/smack.h @@ -21,6 +21,7 @@ #include linux/list.h #include linux/rculist.h #include linux/lsm_audit.h +#include linux/magic.h /* * Smack labels were limited to 23 characters for a long time. @@ -149,11 +150,6 @@ struct smack_known { #define SMACK_CIPSO_SOCKET 1 /* - * smackfs magic number - */ -#define SMACK_MAGIC0x43415d53 /* SMAC */ - -/* * CIPSO defaults. */ #define SMACK_CIPSO_DOI_DEFAULT3 /* Historical */ diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 38be92c..6e8fa99 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -32,7 +32,6 @@ #include linux/pipe_fs_i.h #include net/cipso_ipv4.h #include linux/audit.h -#include linux/magic.h #include linux/dcache.h #include linux/personality.h #include linux/msg.h -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: UAPI for new arches (was Re: [GIT PULL] User API Disintegrate: Preparatory patches)
Vineet Gupta vineet.gup...@synopsys.com wrote: I'm planning to submit ARC Linux kernel port (from Synopsys) for review on lkml and arch mailing lists. I already have a a 3.7-rc3 based kernel (modulo the arch UAPI split). What would be the best way to get the UAPI split done. Can you point me to the latest scripts and the best way to use them (so we have consistent automated split of headers). Otherwise if you like, you could take a stab at it yourself via my tree at git://github.com/organizations/foss-for-synopsys-dwc-arc-processors/linux.git arc-3.7-rc3-newport If you look at: http://git.infradead.org/users/dhowells/linux-headers.git/shortlog/refs/tags/disintegrate-arc-20121108 You'll find a branch with a patch that does the UAPI disintegration for you as one piece. I've merged your branch onto Linus's latest before doing the disintegration. If you'd prefer it directly on your branch, that should be possible too. Hi David, Many thanks for doing this. Looking at the disintegrated headers, I have some observations, very likely due to shortcomings in my code, which need some clarifying. While I'd done some of the prep work in my code such as splitting __KERNEL__ __ASSEMBLY__ into two separate lines, majority of orig headers didn't have #ifdef __KERNEL__ guard despite the code not being meant for user-space ABI. Is that fundamental to UAPI split scripting because it seems to be causing setup.h to be in uapi despite seemingly being kernel internal only. OTOH the missing guards seem to be benign for several other headers (e.g. bug.h) Also there's an empty UAPI header generated (tlb.h) - again very likely due to the missing guard. Per you email from last week, When I ran the disintergrate-one.pl script myself I saw a whole bunch of empty UAPI files being generated with references in orig header. I'm not sure what I'm doing wrong. For any ABI changes to headers per review of the new port on list (e.g. don't export pt_regs) would mean moving the code manually from uapi to orig header - right. And if the file becomes empty just nuke it completely. How do you reckon we go about fixing these. I don't want to bother you multiple times hence it would be best if I could reproduce this at my end. thanks again for you help and time -Vineet -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] drivers: mfd: Fix resource request for [mem 0x00000000]
On Thu, 2012-11-08 at 11:04 -0600, Aaron Sierra wrote: The older southbridges supported by the lpc_ich driver do not provide memory-mapped space of the root complex. The driver correctly avoids computing the iomem address in this case, yet submits a zeroed resource request anyway (via mfd_add_devices()). Remove the iomem resource from the resource array submitted to the mfd core for the older southbridges. Peter, thanks for catching this. + } else { + /* So don't register iomem for TCO ver 1 */ + --lpc_ich_cells[LPC_WDT].num_resources; My only complaint is that pre-decrementing num_resources isn't necessary and doesn't match the other cases where num_resources is decremented (post-decremented), like here: if (!base_addr) { dev_err(dev-dev, I/O space for ACPI uninitialized\n); lpc_ich_cells[LPC_GPIO].num_resources--; goto gpe0_done; } Sorry, C++ force-of-habit. How's this instead? (please note, I also retitled the patch to refer to lpc_ich specifically) -- 8 -- Subject: [PATCH v2 5/5] mfd: lpc_ich: Fix resource request for [mem 0x] The older southbridges supported by the lpc_ich driver do not provide memory-mapped space of the root complex. The driver correctly avoids computing the iomem address in this case, yet submits a zeroed resource request anyway (via mfd_add_devices()). Remove the iomem resource from the resource array submitted to the mfd core for the older southbridges. Cc: Aaron Sierra asie...@xes-inc.com Cc: Peter Tyser pty...@xes-inc.com Cc: Samuel Ortiz sa...@linux.intel.com Signed-off-by: Peter Hurley pe...@hurleysoftware.com --- v2: post-decrement to match existing style retitle patch subject drivers/mfd/lpc_ich.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index a22544f..f507c09 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c @@ -842,6 +842,9 @@ static int __devinit lpc_ich_init_wdt(struct pci_dev *dev, res = wdt_mem_res(ICH_RES_MEM_GCS); res-start = base_addr + ACPIBASE_GCS_OFF; res-end = base_addr + ACPIBASE_GCS_END; + } else { + /* So don't register iomem for TCO ver 1 */ + lpc_ich_cells[LPC_WDT].num_resources--; } lpc_ich_finalize_cell(lpc_ich_cells[LPC_WDT], id); -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 3/3] acpi_memhotplug: Add prepare_remove operation
Offlining and removal of memory is now done in the prepare_remove callback, not in the remove callback. Signed-off-by: Vasilis Liaskovitis vasilis.liaskovi...@profitbricks.com --- drivers/acpi/acpi_memhotplug.c | 22 -- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 7fcc844..9b734a5 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -54,6 +54,7 @@ MODULE_LICENSE(GPL); static int acpi_memory_device_add(struct acpi_device *device); static int acpi_memory_device_remove(struct acpi_device *device, int type); +static int acpi_memory_device_prepare_remove(struct acpi_device *device); static const struct acpi_device_id memory_device_ids[] = { {ACPI_MEMORY_DEVICE_HID, 0}, @@ -68,6 +69,7 @@ static struct acpi_driver acpi_memory_device_driver = { .ops = { .add = acpi_memory_device_add, .remove = acpi_memory_device_remove, + .prepare_remove = acpi_memory_device_prepare_remove, }, }; @@ -499,6 +501,20 @@ static int acpi_memory_device_add(struct acpi_device *device) static int acpi_memory_device_remove(struct acpi_device *device, int type) { struct acpi_memory_device *mem_device = NULL; + + if (!device || !acpi_driver_data(device)) + return -EINVAL; + + mem_device = acpi_driver_data(device); + + kfree(mem_device); + + return 0; +} + +static int acpi_memory_device_prepare_remove(struct acpi_device *device) +{ + struct acpi_memory_device *mem_device = NULL; int result; if (!device || !acpi_driver_data(device)) @@ -506,12 +522,14 @@ static int acpi_memory_device_remove(struct acpi_device *device, int type) mem_device = acpi_driver_data(device); + /* +* offline and remove memory only when the memory device is +* ejected. +*/ result = acpi_memory_remove_memory(mem_device); if (result) return result; - kfree(mem_device); - return 0; } -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 0/3] acpi: Introduce prepare_remove device operation
As discussed in https://patchwork.kernel.org/patch/1581581/ the driver core remove function needs to always succeed. This means we need to know that the device can be successfully removed before acpi_bus_trim / acpi_bus_hot_remove_device are called. This can cause panics when OSPM-initiated eject (echo 1 /sys/bus/acpi/devices/PNP/eject) of memory devices fails, since the ACPI core goes ahead and ejects the device regardless of whether the memory is still in use or not. For this reason a new acpi_device operation called prepare_remove is introduced. This operation should be registered for acpi devices whose removal (from kernel perspective) can fail. Memory devices fall in this category. acpi_bus_hot_remove_device is changed to handle removal in 2 steps: - preparation for removal i.e. perform part of removal that can fail outside of ACPI core. Should succeed for device and all its children. - if above step was successfull, proceed to actual ACPI removal acpi_bus_trim is changed accordingly to handle preparation for removal and actual removal. With this patchset, only acpi memory devices use the new prepare_remove device operation. The actual memory removal (VM-related offline and other memory cleanups) is moved to prepare_remove. The old remove operation just cleans up the acpi structures. Directly ejecting PNP0C80 memory devices works safely. I haven't tested yet with an ACPI container which contains memory devices. Other ACPI devices (e.g. CPU) do not register prepare_remove callbacks, and their OSPM-side eject should not be affected. I am not happy with the name prepare_remove. Comments welcome. Let me know if I should work more in this direction (I think Yasuaki might also look into this and might have a simpler idea) Patches are on top of Rafael's linux-pm/linux-next Vasilis Liaskovitis (3): acpi: Introduce prepare_remove operation in acpi_device_ops acpi: Make acpi_bus_trim handle device removal preparation acpi_memhotplug: Add prepare_remove operation drivers/acpi/acpi_memhotplug.c | 24 +--- drivers/acpi/dock.c|2 +- drivers/acpi/scan.c| 32 +--- drivers/pci/hotplug/acpiphp_glue.c |4 ++-- drivers/pci/hotplug/sgi_hotplug.c |2 +- include/acpi/acpi_bus.h|4 +++- 6 files changed, 57 insertions(+), 11 deletions(-) -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 2/3] acpi: Make acpi_bus_trim handle device removal preparation
A new argument is added to acpi_bus_trim, which indicates if we are preparing for removal or performing the actual ACPI removal. This is needed for safe removal of memory devices. The argument change would not be needed if the existing argument rmdevice of acpi_bus_trim could be used instead. What is the role of rmdevice argument? As far as I can tell the rmdevice argument is never used at the moment (acpi_bus_trim is called with rmdevice=1 from all its call sites. It is never called with rmdevice=0) Signed-off-by: Vasilis Liaskovitis vasilis.liaskovi...@profitbricks.com --- drivers/acpi/acpi_memhotplug.c |2 +- drivers/acpi/dock.c|2 +- drivers/acpi/scan.c| 32 +--- drivers/pci/hotplug/acpiphp_glue.c |4 ++-- drivers/pci/hotplug/sgi_hotplug.c |2 +- include/acpi/acpi_bus.h|2 +- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 92c973a..7fcc844 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -427,7 +427,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) /* * Invoke acpi_bus_trim() to remove memory device */ - acpi_bus_trim(device, 1); + acpi_bus_trim(device, 1, 0); /* _EJ0 succeeded; _OST is not necessary */ return; diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index ae4ebf2..9e37b49 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -345,7 +345,7 @@ static void dock_remove_acpi_device(acpi_handle handle) int ret; if (!acpi_bus_get_device(handle, device)) { - ret = acpi_bus_trim(device, 1); + ret = acpi_bus_trim(device, 1, 0); if (ret) pr_debug(error removing bus, %x\n, -ret); } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 95ff1e8..b1001a4 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -121,7 +121,12 @@ void acpi_bus_hot_remove_device(void *context) ACPI_DEBUG_PRINT((ACPI_DB_INFO, Hot-removing device %s...\n, dev_name(device-dev))); - if (acpi_bus_trim(device, 1)) { + if (acpi_bus_trim(device, 1, 1)) { + pr_err(Preparing to removing device failed\n); + goto err_out; + } + + if (acpi_bus_trim(device, 1, 0)) { printk(KERN_ERR PREFIX Removing device failed\n); goto err_out; @@ -1347,6 +1352,19 @@ static int acpi_device_set_context(struct acpi_device *device) return -ENODEV; } +static int acpi_bus_prepare_remove(struct acpi_device *dev) +{ + int ret = 0; + + if (!dev) + return -EINVAL; + + if (dev-driver dev-driver-ops.prepare_remove) + ret = dev-driver-ops.prepare_remove(dev); + + return ret; +} + static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) { if (!dev) @@ -1640,7 +1658,11 @@ int acpi_bus_start(struct acpi_device *device) } EXPORT_SYMBOL(acpi_bus_start); -int acpi_bus_trim(struct acpi_device *start, int rmdevice) +/* acpi_bus_trim: Remove or prepare to remove a device and its children. + * @device: the device to remove or prepare to remove from. + * @prepare: If 1, prepare for removal. If 0, perform actual removal. + */ +int acpi_bus_trim(struct acpi_device *start, int rmdevice, int prepare) { acpi_status status; struct acpi_device *parent, *child; @@ -1667,7 +1689,11 @@ int acpi_bus_trim(struct acpi_device *start, int rmdevice) child = parent; parent = parent-parent; - if (level == 0) + if (prepare) { + err = acpi_bus_prepare_remove(child); + if (err) + return err; + } else if (level == 0) err = acpi_bus_remove(child, rmdevice); else err = acpi_bus_remove(child, 1); diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3d6d4fd..bc10b61 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -748,7 +748,7 @@ static int acpiphp_bus_add(struct acpiphp_func *func) /* this shouldn't be in here, so remove * the bus then re-add it... */ - ret_val = acpi_bus_trim(device, 1); + ret_val = acpi_bus_trim(device, 1, 0); dbg(acpi_bus_trim return %x\n, ret_val); } @@ -781,7 +781,7 @@ static int acpiphp_bus_trim(acpi_handle handle) return retval; } - retval =
[RFC PATCH 1/3] acpi: Introduce prepare_remove operation in acpi_device_ops
Signed-off-by: Vasilis Liaskovitis vasilis.liaskovi...@profitbricks.com --- include/acpi/acpi_bus.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 2242c10..6ef1692 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -94,6 +94,7 @@ typedef int (*acpi_op_start) (struct acpi_device * device); typedef int (*acpi_op_bind) (struct acpi_device * device); typedef int (*acpi_op_unbind) (struct acpi_device * device); typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); +typedef int (*acpi_op_prepare_remove) (struct acpi_device *device); struct acpi_bus_ops { u32 acpi_op_add:1; @@ -107,6 +108,7 @@ struct acpi_device_ops { acpi_op_bind bind; acpi_op_unbind unbind; acpi_op_notify notify; + acpi_op_prepare_remove prepare_remove; }; #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */ -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Sat, Nov 3, 2012 at 7:46 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: ACPI 5 introduced SPISerialBus resource that allows us to enumerate and configure the SPI slave devices behind the SPI controller. This patch adds support for this to the SPI core. In addition we bind ACPI nodes to SPI devices. This makes it possible for the slave drivers to get the ACPI handle for further configuration. Signed-off-by: Mika Westerberg mika.westerb...@linux.intel.com Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com --- drivers/spi/spi.c | 231 - 1 file changed, 230 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861..de22a6e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -35,6 +35,7 @@ #include linux/sched.h #include linux/delay.h #include linux/kthread.h +#include linux/acpi.h static void spidev_release(struct device *dev) { @@ -93,6 +94,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv) if (of_driver_match_device(dev, drv)) return 1; + /* Then try ACPI */ + if (acpi_driver_match_device(dev, drv)) + return 1; + if (sdrv-id_table) return !!spi_match_id(sdrv-id_table, spi); @@ -888,6 +893,227 @@ static void of_register_spi_devices(struct spi_master *master) static void of_register_spi_devices(struct spi_master *master) { } #endif +#ifdef CONFIG_ACPI +struct acpi_spi { + acpi_status (*callback)(struct acpi_device *, void *); + void *data; +}; + +static acpi_status acpi_spi_enumerate_device(acpi_handle handle, u32 level, +void *data, void **return_value) +{ + struct acpi_spi *acpi_spi = data; + struct acpi_device *adev; + + if (acpi_bus_get_device(handle, adev)) + return AE_OK; + if (acpi_bus_get_status(adev) || !adev-status.present) + return AE_OK; + + return acpi_spi-callback(adev, acpi_spi-data); +} + +static acpi_status acpi_spi_enumerate(acpi_handle handle, + acpi_status (*callback)(struct acpi_device *, void *), void *data) +{ + struct acpi_spi acpi_spi; + + acpi_spi.callback = callback; + acpi_spi.data = data; + + return acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, + acpi_spi_enumerate_device, NULL, + acpi_spi, NULL); +} From my reading of this, the block causes 2 levels of callback indirection. First to either acpi_spi_find_child or acpi_spi_add_device and second to acpi_spi_enumerate_device. All to share about 4 lines of code in acpi_spi_enumerate_device. It took me a while to unravel it. I think acpi_spi_find_child and acpi_spi_add_device should be passed directly to acpi_walk_namespace. Is there anything that prevents that? I also agree with the discussion that the actual parsing code for the resources should be common,. Retrieving things like IRQs and address resources should be function calls into ACPI helpers instead of open coding it in the spi core code. Otherwise the patch looks sane to me. g. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tools: hv: Netlink source address validation allows DoS
The source code without this patch caused hypervkvpd to exit when it processed a spoofed Netlink packet which has been sent from an untrusted local user. Now Netlink messages with a non-zero nl_pid source address are ignored and a warning is printed into the syslog. Signed-off-by: Tomas Hozza tho...@redhat.com --- tools/hv/hv_kvp_daemon.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 13c2a14..c1d9102 100755 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -1486,13 +1486,19 @@ int main(void) len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, addr_p, addr_l); - if (len 0 || addr.nl_pid) { + if (len 0) { syslog(LOG_ERR, recvfrom failed; pid:%u error:%d %s, addr.nl_pid, errno, strerror(errno)); close(fd); return -1; } + if (addr.nl_pid) { + syslog(LOG_WARNING, Received packet from untrusted pid:%u, + addr.nl_pid); + continue; + } + incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); hv_msg = (struct hv_kvp_msg *)incoming_cn_msg-data; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [RFC PATCH v1 08/31] ARC: Fundamental ARCH data-types/defines
On 7 November 2012 10:47, Vineet Gupta vineet.gup...@synopsys.com wrote: diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h new file mode 100644 index 000..c178357 --- /dev/null +++ b/arch/arc/include/asm/ptrace.h @@ -0,0 +1,120 @@ +/* THE pt_regs: Defines how regs are saved during entry into kernel */ + +struct pt_regs { I'd recommend not exporting the pt_regs structure to userspace. This struct is used heavily within the kernel and it's nice to have the leeway to be able to modify it as things evolve. GDB doesn't need to know about this struct anymore as it should be using regset's for any recent architectures anyway, so it's the regset layout that should be ABI stable instead of pt_regs. You can check the openrisc architecture as an example of how to do this. Hi Jonas, thanks for your review comment. I completely agree that pt_regs should not be exported and very recently a change in pt_regs forced a gdbserver change too (ABI incompatibility) which goes along what you are recommending. Infact the ptrace patch for kernel (which will follow in series #2) provides a stable regset ABI - extracting information from pt_regs. However our current gdb/gdbserver is 6.8 based and making it switch to regset interface might not be possible for this release of tools. Since customers are already using our stuff, we can not have a broken ABI. We do have ABI versioning, so in next release we can fix gdb and remove this. Please note that an additional reason for exporting pt_regs is due to the fact that it is part of sigcontext. Keeping it exactly same as pt_regs helps us do batch save/restore of user context in signal handling (please look at my signal handling patch) but the flip side is that userspace SA_SIGINFO needs to be able to have access to sigcontext and hence we explicitly need pt_regs. We could arguably opencode pt_regs there - but that won't be clean IMHO. What do you think ! -Vineet-- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] drivers: mfd: Fix resource request for [mem 0x00000000]
v2: post-decrement to match existing style retitle patch subject drivers/mfd/lpc_ich.c | 3 +++ 1 file changed, 3 insertions(+) Acked-by: Aaron Sierra asie...@xes-inc.com You could make Samuel's job easier by sending a new e-mail with the latest patch and the correct subject in the e-mail's subject line. Since this patch doesn't really depend on any of the other four you submitted, a new message/subject like this seems appropriate to me: [PATCH v3] mfd: lpc_ich: Fix resource request for [mem 0x] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] i2c / ACPI: add ACPI enumeration support
On Sat, Nov 3, 2012 at 7:46 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: ACPI 5 introduced I2cSerialBus resource that makes it possible to enumerate and configure the I2C slave devices behind the I2C controller. This patch adds helper functions to support I2C slave enumeration. An ACPI enabled I2C controller driver only needs to call acpi_i2c_register_devices() in order to get its slave devices enumerated, created and bound to the corresponding ACPI handle. Signed-off-by: Mika Westerberg mika.westerb...@linux.intel.com Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com --- drivers/acpi/Kconfig |6 ++ drivers/acpi/Makefile|1 + drivers/acpi/acpi_i2c.c | 234 ++ drivers/i2c/i2c-core.c |9 ++ include/linux/acpi_i2c.h | 29 ++ 5 files changed, 279 insertions(+) create mode 100644 drivers/acpi/acpi_i2c.c create mode 100644 include/linux/acpi_i2c.h diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 119d58d..0300bf6 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -181,6 +181,12 @@ config ACPI_DOCK This driver supports ACPI-controlled docking stations and removable drive bays such as the IBM Ultrabay and the Dell Module Bay. +config ACPI_I2C + def_tristate I2C + depends on I2C + help + ACPI I2C enumeration support. + config ACPI_PROCESSOR tristate Processor select THERMAL diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index a7badb5..8573346 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -69,6 +69,7 @@ obj-$(CONFIG_ACPI_HED)+= hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o obj-$(CONFIG_ACPI_BGRT)+= bgrt.o +obj-$(CONFIG_ACPI_I2C) += acpi_i2c.o # processor has its own processor. module_param namespace processor-y:= processor_driver.o processor_throttling.o diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c new file mode 100644 index 000..dc6997e --- /dev/null +++ b/drivers/acpi/acpi_i2c.c @@ -0,0 +1,234 @@ +/* + * ACPI I2C enumeration support + * + * Copyright (C) 2012, Intel Corporation + * Author: Mika Westerberg mika.westerb...@linux.intel.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/acpi.h +#include linux/i2c.h +#include linux/module.h + +struct acpi_i2c { + acpi_status (*callback)(struct acpi_device *, void *); + void *data; +}; + +static acpi_status acpi_i2c_enumerate_device(acpi_handle handle, u32 level, +void *data, void **return_value) +{ + struct acpi_i2c *acpi_i2c = data; + struct acpi_device *adev; + + if (acpi_bus_get_device(handle, adev)) + return AE_OK; + if (acpi_bus_get_status(adev) || !adev-status.present) + return AE_OK; + + return acpi_i2c-callback(adev, acpi_i2c-data); +} + +static acpi_status acpi_i2c_enumerate(acpi_handle handle, + acpi_status (*callback)(struct acpi_device *, void *), void *data) +{ + struct acpi_i2c acpi_i2c; + + acpi_i2c.callback = callback; + acpi_i2c.data = data; + + return acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, + acpi_i2c_enumerate_device, NULL, + acpi_i2c, NULL); +} Same comment here as for the SPI patch. The two levels of indirection is more convoluted than it needs to be. Can acpi_i2c_find_client and acpi_i2c_add_device be passed directly to acpi_walk_namespace? g. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[REGRESSION] Kernel 3.5 to 3.7-rc4 / GMA500 / DPMS sometimes crashes system
Hello, I have an issue with the GMA500 driver for kernels from 3.5 up to 3.7-rc4. I am using an Intel board with a D2700 Atom processor running Debian unstable. Sometimes when DPMS switches off the screen the system reboots. More often it does not reboot but shows a white screen on reactivation. Then I can ssh into the box from another host but the white screen remains even if I restart X or change VT. This never seems to happen the first time the screen is switched off, generally it takes 3 or 4 cycles to trigger the bug. Kernel 3.4.3 works fine. There are no messages in the logs. Any idea what might cause this or how I can debug it any further? I will supply more details on my setup if needed. Please CC me in your reply as I am not subscribed to the list. Thanks in advance Georg Chini -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/9 v3] cgroup: add cgroup_subsys-post_create()
Subject: cgroup: add cgroup_subsys-post_create() Currently, there's no way for a controller to find out whether a new cgroup finished all -create() allocatinos successfully and is considered live by cgroup. This becomes a problem later when we add generic descendants walking to cgroup which can be used by controllers as controllers don't have a synchronization point where it can synchronize against new cgroups appearing in such walks. This patch adds -post_create(). It's called after all -create() succeeded and the cgroup is linked into the generic cgroup hierarchy. This plays the counterpart of -pre_destroy(). When used in combination with the to-be-added generic descendant iterators, -post_create() can be used to implement reliable state inheritance. It will be explained with the descendant iterators. v2: Added a paragraph about its future use w/ descendant iterators per Michal. v3: Forgot to add -post_create() invocation to cgroup_load_subsys(). Fixed. Signed-off-by: Tejun Heo t...@kernel.org Acked-by: Michal Hocko mho...@suse.cz Reviewed-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com Cc: Glauber Costa glom...@parallels.com --- Oops, forgot updating cgroup_load_subsys(). Hate that it's a different path from cgroup_init_subsys(). :( Thanks. include/linux/cgroup.h |1 + kernel/cgroup.c| 15 +-- 2 files changed, 14 insertions(+), 2 deletions(-) --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -438,6 +438,7 @@ int cgroup_taskset_size(struct cgroup_ta struct cgroup_subsys { struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); + void (*post_create)(struct cgroup *cgrp); void (*pre_destroy)(struct cgroup *cgrp); void (*destroy)(struct cgroup *cgrp); int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4059,10 +4059,15 @@ static long cgroup_create(struct cgroup if (err 0) goto err_remove; - /* each css holds a ref to the cgroup's dentry */ - for_each_subsys(root, ss) + for_each_subsys(root, ss) { + /* each css holds a ref to the cgroup's dentry */ dget(dentry); + /* creation succeeded, notify subsystems */ + if (ss-post_create) + ss-post_create(cgrp); + } + /* The cgroup directory was pre-locked for us */ BUG_ON(!mutex_is_locked(cgrp-dentry-d_inode-i_mutex)); @@ -4280,6 +4285,9 @@ static void __init cgroup_init_subsys(st ss-active = 1; + if (ss-post_create) + ss-post_create(ss-root-top_cgroup); + /* this function shouldn't be used with modular subsystems, since they * need to register a subsys_id, among other things */ BUG_ON(ss-module); @@ -4389,6 +4397,9 @@ int __init_or_module cgroup_load_subsys( ss-active = 1; + if (ss-post_create) + ss-post_create(ss-root-top_cgroup); + /* success! */ mutex_unlock(cgroup_mutex); return 0; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: gadget: ncm: correct endianess conversion
On Thu, Nov 8, 2012 at 3:06 PM, Felipe Balbi ba...@ti.com wrote: Hi, (please, never top-post) got it! On Wed, Nov 07, 2012 at 02:14:00PM +0100, Dmytro Milinevskyy wrote: Unfortunately I have some issues with git send-email. I've attached the patch itself .. I'll apply it like that this time, but try to figure out how to send patches properly. We have some very helpful hints on Documentation/email-clients.txt which are hugely underused ;-) well, I try to follow the rules as much as possible as long as tools work ... =) regards, -- dmytro -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [RFC Patch v1 00/31] Synopsys ARC Linux kernel Port
Hi Arnd, Thanks for your valuable comments I will rework the port. P.S. Sorry for top-posting. Thanks, Vineet On Wednesday 07 November 2012, Vineet Gupta wrote: This patchset based off-of 3.7-rc3, introduces the Linux kernel port to ARC700 processor family (750D and 770D) from Synopsys. ARC700 is highly configurable and power efficient 32-bit RISC core with MMU. It is embedded in SoCs deployed in TV Set Top boxes, Digital Media Players, all the way to Network-on-Chips. Hi Vineet, I'm largely quite happy with how the series has turned out, having looked at earlier versions of the ARC kernel a couple of years ago. I've commented already on individual patches, but overall, I see two main issues that need to be resolved in order to merge the port: * You have to use the generic syscall interface, and that means not using any of the legacy system calls that have since been replaced by newer versions of the same. * You are missing dynamic hardware detection. Rather than building a kernel with everything known about the hardware at compile time, new ports these days are normally able to run on all kinds of hardware and detect the differences by looking at configuration registers (e.g. PCI), asking firmware (Open Firmware, ACPI, ...) or by interpreting a device tree that is passed by the boot loader (most embedded systems). I assume that device tree is the right solution for you because a lot of the hardware you use is likely shared with ARM, PowerPC or MIPS based SoCs and they are all using (or getting migrated to) DT now instead of static platform devices, Arnd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] loop: Limit the number of requests in the bio list
On Tue, 16 Oct 2012 11:21:45 +0200 Lukas Czerner lczer...@redhat.com wrote: Currently there is not limitation of number of requests in the loop bio list. This can lead into some nasty situations when the caller spawns tons of bio requests taking huge amount of memory. This is even more obvious with discard where blkdev_issue_discard() will submit all bios for the range and wait for them to finish afterwards. On really big loop devices and slow backing file system this can lead to OOM situation as reported by Dave Chinner. With this patch we will wait in loop_make_request() if the number of bios in the loop bio list would exceed 'nr_requests' number of requests. We'll wake up the process as we process the bios form the list. Some threshold hysteresis is in place to avoid high frequency oscillation. What's happening with this? --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -463,6 +463,7 @@ out: */ static void loop_add_bio(struct loop_device *lo, struct bio *bio) { + lo-lo_bio_count++; bio_list_add(lo-lo_bio_list, bio); } @@ -471,6 +472,7 @@ static void loop_add_bio(struct loop_device *lo, struct bio *bio) */ static struct bio *loop_get_bio(struct loop_device *lo) { + lo-lo_bio_count--; return bio_list_pop(lo-lo_bio_list); } @@ -489,6 +491,14 @@ static void loop_make_request(struct request_queue *q, struct bio *old_bio) goto out; if (unlikely(rw == WRITE (lo-lo_flags LO_FLAGS_READ_ONLY))) goto out; + if (lo-lo_bio_count = lo-lo_queue-nr_requests) { + unsigned int nr; + spin_unlock_irq(lo-lo_lock); + nr = lo-lo_queue-nr_requests - (lo-lo_queue-nr_requests/8); + wait_event_interruptible(lo-lo_req_wait, + lo-lo_bio_count nr); + spin_lock_irq(lo-lo_lock); + } Two things. a) wait_event_interruptible() will return immediately if a signal is pending (eg, someone hit ^C). This is not the behaviour you want. If the calling process is always a kernel thread then wait_event_interruptible() is OK and is the correct thing to use. Otherwise, it will need to be an uninterruptible sleep. b) Why is it safe to drop lo_lock here? What data is that lock protecting? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch] acpi, pm: fix build breakage
Commit b87b49cd0efd (ACPI / PM: Move device PM functions related to sleep states) declared acpi_target_system_state() for CONFIG_PM_SLEEP whereas it is only defined for CONFIG_ACPI_SLEEP, resulting in the following link error: drivers/built-in.o: In function `acpi_pm_device_sleep_wake': drivers/acpi/device_pm.c:342: undefined reference to `acpi_target_system_state' drivers/built-in.o: In function `acpi_dev_suspend_late': drivers/acpi/device_pm.c:501: undefined reference to `acpi_target_system_state' drivers/built-in.o: In function `acpi_pm_device_sleep_state': drivers/acpi/device_pm.c:221: undefined reference to `acpi_target_system_state' Define it only for CONFIG_ACPI_SLEEP and fallback to a dummy definition for other configs. Signed-off-by: David Rientjes rient...@google.com --- include/acpi/acpi_bus.h |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -469,11 +469,9 @@ static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) #endif #ifdef CONFIG_PM_SLEEP -u32 acpi_target_system_state(void); int __acpi_device_sleep_wake(struct acpi_device *, u32, bool); int acpi_pm_device_sleep_wake(struct device *, bool); #else -static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } static inline int __acpi_device_sleep_wake(struct acpi_device *adev, u32 target_state, bool enable) { @@ -485,6 +483,12 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) } #endif +#ifdef CONFIG_ACPI_SLEEP +u32 acpi_target_system_state(void); +#else +static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } +#endif + static inline bool acpi_device_power_manageable(struct acpi_device *adev) { return adev-flags.power_manageable; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v6 25/29] memcg/sl[au]b: shrink dead caches
On Thu, 8 Nov 2012 17:15:36 + Christoph Lameter c...@linux.com wrote: On Wed, 7 Nov 2012, Andrew Morton wrote: What's up with kmem_cache_shrink? It's global and exported to modules but its only external caller is some weird and hopelessly poorly documented site down in drivers/acpi/osl.c. slab and slob implement kmem_cache_shrink() *only* for acpi! wtf? Let's work out what acpi is trying to actually do there, then do it properly, then killkillkill! kmem_cache_shrink is also used internally. Its simply releasing unused cached objects. Only in slub. It could be removed outright from the others and simplified in slub. Secondly, as slab and slub (at least) have the ability to shed cached memory, why aren't they hooked into the core cache-shinking machinery. After all, it's called shrink_slab! Because the core cache shrinking needs the slab caches to free up memory from inodes and dentries. We could call kmem_cache_shrink at the end of the shrink passes in vmscan. The price would be that the caches would have to be repopulated when new allocations occur. Well, the shrinker shouldn't strips away all the cache. It will perform a partial trim, the magnitude of which increases with perceived external memory pressure. AFACIT, this is correct and desirable behaviour for shrinking slab's internal caches. If we can fix all that up then I wonder whether this particular patch needs to exist at all. If the kmem_cache is no longer used then we can simply leave it floating around in memory and the regular cache shrinking code out of shrink_slab() will clean up any remaining pages. The kmem_cache itself can be reclaimed via another shrinker, if necessary? The kmem_cache can only be released if all its objects (used and unused) are released. kmem_cache_shrink drops the unused objects on some internal slab specific list. That may enable us to release the kmem_cache structure. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/8] aoe: avoid running request handler on plugged queue
On Thu, 8 Nov 2012 11:29:32 -0500 Ed Cashin ecas...@coraid.com wrote: Signed-off-by: Ed Cashin ecas...@coraid.com Could you please prepare decent changelogs for the patches? Several of these appear to be bugfixes but we have no description of the user-visible behavioural changes. So nobody knows what the patches do, nor which kernel version(s) they should be merged into. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/8] aoe: avoid running request handler on plugged queue
On Nov 8, 2012, at 2:26 PM, Andrew Morton wrote: On Thu, 8 Nov 2012 11:29:32 -0500 Ed Cashin ecas...@coraid.com wrote: Signed-off-by: Ed Cashin ecas...@coraid.com Could you please prepare decent changelogs for the patches? Several of these appear to be bugfixes but we have no description of the user-visible behavioural changes. So nobody knows what the patches do, nor which kernel version(s) they should be merged into. Yes, sure. For this one, I Cc'ed Jens Axboe in part because although I believe that it is correct to use __blk_run_queue rather than to call the request handler directly, I am going on old information. I'm not entirely sure what the user impact is when the request hander is called directly, other than perhaps a slight performance hit. But I'd like to do the right thing. Jens Axboe, if you have a comment about correctness or user impact, I'd like to include that information in the changelog for this commit. Or if the change doesn't look right to you, I'd like to know that. Thanks. -- Ed Cashin ecas...@coraid.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Wed, Nov 7, 2012 at 2:56 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: On Tue, Nov 06, 2012 at 11:18:11PM +0100, Rafael J. Wysocki wrote: How is the SPI controller different than this? Is there some logical difference that requires a different framework? Or are you proposing that we get rid of acpi_bus_register_driver() and migrate everything to this new framework? Yes, I do, but let's just do it gradually. Bjorn, here is a concrete example how this is supposed to be used. Lets say we have an existing SPI slave driver that we want to extend to support enumeration from ACPI. Instead of writing acpi_driver glue for that (and registering it using acpi_bus_register_driver()) what we do is simple add these to the existing SPI driver: #ifdef CONFIG_ACPI static struct acpi_device_id my_spidrv_match[] = { /* ACPI IDs here */ { } }; MODULE_DEVICE_TABLE(acpi, my_spidrv_match); #endif static struct spi_driver my_spidrv = { ... .driver = { .acpi_match_table = ACPI_PTR(my_spidrv_match), }, }; The same thing works with platform, I2c and SPI drivers and can be extented to others as well. If the driver needs to do some ACPI specific configuration it can get the ACPI handle using its dev-acpi_handle. The above example now supports both, normal SPI (where the devices are enumerated by populating spi_board_info()) and ACPI. Adding support for Device Tree is similar than ACPI so a single driver can support all three easily at the same time. Thanks for the concrete example; that helps me a lot. Struct device_driver is a generic structure, so it seems strange to have to include non-generic things like of_device_id and now acpi_match_table there. I'm actually interested in the details you didn't include above, too. For example, I don't know of a generic way to get resource information from a struct device *, so I assume you need to figure out what sort of device it is and then do the appropriate PCI/ACPI/OF/DT/etc operations to learn the resources? I think it would be cool if there *were* a generic way to get struct device resources. Then you could imagine a mechanism where a driver supplied a list of identifiers it could claim, e.g., PCI_VEN_DEV(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART), ACPI_ID(PNP0501), etc., and it might not need to know anything more than what the identifier is. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] gpio / ACPI: add ACPI support
On Thu, Nov 08, 2012 at 03:55:18PM +, Grant Likely wrote: Hi Mika, On Sat, Nov 3, 2012 at 7:46 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: From: Mathias Nyman mathias.ny...@linux.intel.com Add support for translating ACPI GPIO pin numbers to Linux GPIO API pins. Needs a gpio controller driver with the acpi handler hook set. Drivers can use acpi_get_gpio() to translate ACPI5 GpioIO and GpioInt resources to Linux GPIO's. How does the mapping work? Is the ACPI gpio number space kept completely separate from the Linux GPIO numbers, or is there any attempt to line up ACPI and Linux GPIO numbering? From my reading, it /looks/ like the ACPI GPIO numbering is controller-local (no single large global space) because both a full path and a pin number are specified, but I'd like to know for sure. Yes, the ACPI GPIO number from GpioIO/GpioInt resources are controller relative and we use the path from the resource to find the actual controller. Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Mika Westerberg mika.westerb...@linux.intel.com Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com --- drivers/gpio/Kconfig|4 +++ drivers/gpio/Makefile |1 + drivers/gpio/gpiolib-acpi.c | 60 +++ include/linux/acpi_gpio.h | 19 ++ 4 files changed, 84 insertions(+) create mode 100644 drivers/gpio/gpiolib-acpi.c create mode 100644 include/linux/acpi_gpio.h diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index d055cee..2f1905b 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -49,6 +49,10 @@ config OF_GPIO def_bool y depends on OF !SPARC +config ACPI_GPIO Nit: Can you flip this around to GPIO_ACPI? I know OF_GPIO is the other way around, but it should be changed. Sure. diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c new file mode 100644 index 000..ef56ea4 --- /dev/null +++ b/drivers/gpio/gpiolib-acpi.c @@ -0,0 +1,60 @@ +/* + * ACPI helpers for GPIO API + * + * Copyright (C) 2012, Intel Corporation + * Author: Mathias Nyman mathias.ny...@linux.intel.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/errno.h +#include linux/gpio.h +#include linux/module.h +#include linux/acpi_gpio.h +#include linux/acpi.h + +static int acpi_gpiochip_find(struct gpio_chip *gc, void *data) +{ + acpi_handle handle = data; + acpi_handle gc_handle; + + if (!gc-dev) + return false; + + gc_handle = gc-dev-acpi_handle; + if (!gc_handle) + return false; This test is redundant with the next one... unless 'handle' is also NULL :-) Is it at all possible for multiple gpiochips to be used for a single ACPI gpio controller node? Such as if the gpio controller has multiple banks that should be controlled separately? If so then this won't be sufficient. I've got the same issue with DT support where the find function needs to also check if the pin is provided by that specific gpiochip. AFAIK no but I'll let Mathias to answer that as he knows this better. Overall the patch looks good, but I need to see how it is used. It would be really nice if device drivers could use basically the same interface to obtain Linux gpio numbers regardless of if the backing data was ACPI or DT. This API is one level below that. Yeah, this patch just mimics the DT version but in general it would be better if there was only one API to get the GPIO. There has been discussion about adding gpio_get() or something similar which could perhaps be used to abstract away DT or ACPI. We use this in a driver so that we walk through the ACPI resources for a given device (if we have the ACPI handle) and parse the GpioIO/GpioInt resources like: struct acpi_resource_gpio *acpi_gpio; struct acpi_device *adev; acpi_resource *res; int gpio; /* obtain the ACPI device from handle */ ... /* walk through the resources attached to adev */ ... switch (res-type) { case ACPI_RESOURCE_TYPE_GPIO: acpi_gpio = res-data.gpio; gpio = acpi_get_gpio(acpi_gpio-resource_source.string_ptr, acpi_gpio-pin_table[0]); ... } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: gadget: ncm: correct endianess conversion
Hi, On Thu, Nov 08, 2012 at 08:07:57PM +0100, Dmytro Milinevskyy wrote: On Wed, Nov 07, 2012 at 02:14:00PM +0100, Dmytro Milinevskyy wrote: Unfortunately I have some issues with git send-email. I've attached the patch itself .. I'll apply it like that this time, but try to figure out how to send patches properly. We have some very helpful hints on Documentation/email-clients.txt which are hugely underused ;-) well, I try to follow the rules as much as possible as long as tools work ... =) git send-email has thousands of users and it works fine for them (including myself). Maybe you just misconfigured it ?!? ;-) cheers -- balbi signature.asc Description: Digital signature
Re: [RFC PATCH 0/8][Sorted-buddy] mm: Linux VM Infrastructure to support Memory Power Management
On 11/08/2012 11:32 PM, Mel Gorman wrote: On Wed, Nov 07, 2012 at 01:22:13AM +0530, Srivatsa S. Bhat wrote: Today memory subsystems are offer a wide range of capabilities for managing memory power consumption. As a quick example, if a block of memory is not referenced for a threshold amount of time, the memory controller can decide to put that chunk into a low-power content-preserving state. And the next reference to that memory chunk would bring it back to full power for read/write. With this capability in place, it becomes important for the OS to understand the boundaries of such power-manageable chunks of memory and to ensure that references are consolidated to a minimum number of such memory power management domains. How much power is saved? Last year, Amit had evaluated the Hierarchy patchset on a Samsung Exynos (ARM) board and reported that it could save up to 6.3% relative to total system power. (This was when he allowed only 1 GB out of the total 2 GB RAM to enter low power states). Below is the link to his post, as mentioned in the references section in the cover letter. http://article.gmane.org/gmane.linux.kernel.mm/65935 Of course, the power savings depends on the characteristics of the particular hardware memory subsystem used, and the amount of memory present in the system. ACPI 5.0 has introduced MPST tables (Memory Power State Tables) [5] so that the firmware can expose information regarding the boundaries of such memory power management domains to the OS in a standard way. I'm not familiar with the ACPI spec but is there support for parsing of MPST and interpreting the associated ACPI events? Sorry I should have been clearer when I mentioned ACPI 5.0. I mentioned ACPI 5.0 just to make a point that support for getting the memory power management boundaries from the firmware is not far away. I didn't mean to say that that's the only target for memory power management. Like I mentioned above, last year the power-savings benefit was measured on ARM boards. The aim of this patchset is to propose and evaluate some of the core VM algorithms that we will need to efficiently exploit the power management features offered by the memory subsystems. IOW, info regarding memory power domain boundaries made available by ACPI 5.0 or even just with some help from the bootloader on some platforms is only the input to the VM subsystem to understand at what granularity it should manage things. *How* it manages is the choice of the algorithm/design at the VM level, which is what this patchset is trying to propose, by exploring several different designs of doing it and its costs/benefits. That's the reason I just hard-coded mem region size to 512 MB in this patchset and focussed on the VM algorithm to explore what we can do, once we have that size/boundary info. For example, if ACPI fires an event indicating that a memory power node is to enter a low state then presumably the OS should actively migrate pages away -- even if it's going into a state where the contents are still refreshed as exiting that state could take a long time. We are not really looking at ACPI event notifications here. All we expect from the firmware (at a first level) is info regarding the boundaries, so that the VM can be intelligent about how it consolidates references. Many of the memory subsystems can do power-management automatically - like for example, if a particular chunk of memory is not referenced for a given threshold time, it can put it into low-power (content preserving) state without the OS telling it to do it. I did not look closely at the patchset at all because it looked like the actual support to use it and measure the benefit is missing. Right, we are focussing on the core VM algorithms for now. The input (ACPI or other methods) can come later and then we can measure the numbers. How can Linux VM help memory power savings? o Consolidate memory allocations and/or references such that they are not spread across the entire memory address space. Basically area of memory that is not being referenced, can reside in low power state. Which the series does not appear to do. Well, it influences page-allocation to be memory-region aware. So it does an attempt to consolidate allocations (and thereby references). As I mentioned, hardware transition to low-power state can be automatic. The VM must be intelligent enough to help with that (or atleast smart enough not to disrupt that!), by avoiding spreading across allocations everywhere. o Support targeted memory reclaim, where certain areas of memory that can be easily freed can be offlined, allowing those areas of memory to be put into lower power states. Which the series does not appear to do judging from this; Yes, that is one of the items in the TODO list. include/linux/mm.h | 38 +++ include/linux/mmzone.h | 52 +
Re: Kdump with signed images
On Tue, Nov 06, 2012 at 03:51:59PM -0800, Eric W. Biederman wrote: [..] Thnking more about executable signature verification, I have another question. While verifyign the signature, we will have to read the whole executable in memory. That sounds bad as we are in kernel mode and will not be killed and if sombody is trying to execute a malformed exceptionally large executable, system will start killing other processess. We can potentially lock all the memory in kernel just by trying to execute a signed huge executable. Not good. I was looking at IMA and they seem to be using kernel_read() for reading page in and update digest. IIUC, that means page is read from disk, brought in cache and if needed will be read back from disk. But that means hacker can try to do some timing tricks and try to replace disk image after signature verification and run unsigned program. So how do we go about it. Neither of the approaches sound appealing to me. Thanks Vivek -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Kdump with signed images
On Thu, Nov 08, 2012 at 02:40:50PM -0500, Vivek Goyal wrote: On Tue, Nov 06, 2012 at 03:51:59PM -0800, Eric W. Biederman wrote: [..] Thnking more about executable signature verification, I have another question. While verifyign the signature, we will have to read the whole executable in memory. That sounds bad as we are in kernel mode and will not be killed and if sombody is trying to execute a malformed exceptionally large executable, system will start killing other processess. We can potentially lock all the memory in kernel just by trying to execute a signed huge executable. Not good. Also, even if we try to read in whole executable, can't an hacker modify pages in swap disk and then they will be faulted back in and bingo hacker is running its unsigned code. (assuming root has been compromised otherwise why do we have to do all this exercise). Thanks Vivek -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging/media: Use dev_ or pr_ printks in lirc/lirc_sasem.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... - WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ... - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_sasem.c | 65 --- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index f4e4d90..9be4d3f 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -34,6 +34,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/errno.h #include linux/init.h #include linux/kernel.h @@ -171,7 +173,7 @@ static void delete_context(struct sasem_context *context) kfree(context); if (debug) - printk(KERN_INFO %s: context deleted\n, __func__); + pr_info(%s: context deleted\n, __func__); } static void deregister_from_lirc(struct sasem_context *context) @@ -181,11 +183,10 @@ static void deregister_from_lirc(struct sasem_context *context) retval = lirc_unregister_driver(minor); if (retval) - printk(KERN_ERR %s: unable to deregister from lirc (%d)\n, - __func__, retval); + pr_err(%s: unable to deregister from lirc (%d)\n, + __func__, retval); else - printk(KERN_INFO Deregistered Sasem driver (minor:%d)\n, - minor); + pr_info(Deregistered Sasem driver (minor:%d)\n, minor); } @@ -206,8 +207,7 @@ static int vfd_open(struct inode *inode, struct file *file) subminor = iminor(inode); interface = usb_find_interface(sasem_driver, subminor); if (!interface) { - printk(KERN_ERR KBUILD_MODNAME - : %s: could not find interface for minor %d\n, + pr_err(%s: could not find interface for minor %d\n, __func__, subminor); retval = -ENODEV; goto exit; @@ -252,8 +252,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) context = (struct sasem_context *) file-private_data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - : %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return -ENODEV; } @@ -266,7 +265,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) context-vfd_contrast = (unsigned int)arg; break; default: - printk(KERN_INFO Unknown IOCTL command\n); + pr_info(Unknown IOCTL command\n); mutex_unlock(context-ctx_lock); return -ENOIOCTLCMD; /* not supported */ } @@ -287,8 +286,7 @@ static int vfd_close(struct inode *inode, struct file *file) context = (struct sasem_context *) file-private_data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - : %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return -ENODEV; } @@ -299,7 +297,7 @@ static int vfd_close(struct inode *inode, struct file *file) retval = -EIO; } else { context-vfd_isopen = 0; - printk(KERN_INFO VFD port closed\n); + dev_info(context-dev-dev, VFD port closed\n); if (!context-dev_present !context-ir_isopen) { /* Device disconnected before close and IR port is @@ -373,16 +371,14 @@ static ssize_t vfd_write(struct file *file, const char *buf, context = (struct sasem_context *) file-private_data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - : %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return -ENODEV; } mutex_lock(context-ctx_lock); if (!context-dev_present) { - printk(KERN_ERR KBUILD_MODNAME - : %s: no Sasem device present\n, __func__); + pr_err(%s: no Sasem device present\n, __func__); retval = -ENODEV; goto exit; } @@ -519,7 +515,7 @@ static int ir_open(void *data) __func__, retval); else { context-ir_isopen = 1; - printk(KERN_INFO IR port opened\n); + dev_info(context-dev-dev, IR port
[PATCH] staging/media: Use pr_ printks in lirc/lirc_sir.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_sir.c | 36 + 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index 4afc3b4..9a88f05 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -33,6 +33,8 @@ * parts cut'n'pasted from sa1100_ir.c (C) 2000 Russell King */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/module.h #include linux/sched.h #include linux/errno.h @@ -495,7 +497,7 @@ static int init_chrdev(void) driver.dev = lirc_sir_dev-dev; driver.minor = lirc_register_driver(driver); if (driver.minor 0) { - printk(KERN_ERR LIRC_DRIVER_NAME : init_chrdev() failed.\n); + pr_err(init_chrdev() failed.\n); return -EIO; } return 0; @@ -604,7 +606,7 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) } if (status UTSR0_TFS) - printk(KERN_ERR transmit fifo not full, shouldn't happen\n); + pr_err(transmit fifo not full, shouldn't happen\n); /* We must clear certain bits. */ status = (UTSR0_RID | UTSR0_RBB | UTSR0_REB); @@ -787,7 +789,7 @@ static int init_hardware(void) #ifdef LIRC_ON_SA1100 #ifdef CONFIG_SA1100_BITSY if (machine_is_bitsy()) { - printk(KERN_INFO Power on IR module\n); + pr_info(Power on IR module\n); set_bitsy_egpio(EGPIO_BITSY_IR_ON); } #endif @@ -885,8 +887,7 @@ static int init_hardware(void) udelay(1500); /* read previous control byte */ - printk(KERN_INFO LIRC_DRIVER_NAME - : 0x%02x\n, sinp(UART_RX)); + pr_info(0x%02x\n, sinp(UART_RX)); /* Set DLAB 1. */ soutp(UART_LCR, sinp(UART_LCR) | UART_LCR_DLAB); @@ -964,8 +965,7 @@ static int init_port(void) /* get I/O port access and IRQ line */ #ifndef LIRC_ON_SA1100 if (request_region(io, 8, LIRC_DRIVER_NAME) == NULL) { - printk(KERN_ERR LIRC_DRIVER_NAME - : i/o port 0x%.4x already in use.\n, io); + pr_err(i/o port 0x%.4x already in use.\n, io); return -EBUSY; } #endif @@ -975,15 +975,11 @@ static int init_port(void) # ifndef LIRC_ON_SA1100 release_region(io, 8); # endif - printk(KERN_ERR LIRC_DRIVER_NAME - : IRQ %d already in use.\n, - irq); + pr_err(IRQ %d already in use.\n, irq); return retval; } #ifndef LIRC_ON_SA1100 - printk(KERN_INFO LIRC_DRIVER_NAME - : I/O port 0x%.4x, IRQ %d.\n, - io, irq); + pr_info(I/O port 0x%.4x, IRQ %d.\n, io, irq); #endif init_timer(timerlist); @@ -1213,8 +1209,7 @@ static int init_lirc_sir(void) if (retval 0) return retval; init_hardware(); - printk(KERN_INFO LIRC_DRIVER_NAME - : Installed.\n); + pr_info(Installed.\n); return 0; } @@ -1243,23 +1238,20 @@ static int __init lirc_sir_init(void) retval = platform_driver_register(lirc_sir_driver); if (retval) { - printk(KERN_ERR LIRC_DRIVER_NAME : Platform driver register - failed!\n); + pr_err(Platform driver register failed!\n); return -ENODEV; } lirc_sir_dev = platform_device_alloc(lirc_dev, 0); if (!lirc_sir_dev) { - printk(KERN_ERR LIRC_DRIVER_NAME : Platform device alloc - failed!\n); + pr_err(Platform device alloc failed!\n); retval = -ENOMEM; goto pdev_alloc_fail; } retval = platform_device_add(lirc_sir_dev); if (retval) { - printk(KERN_ERR LIRC_DRIVER_NAME : Platform device add - failed!\n); + pr_err(Platform device add failed!\n); retval = -ENODEV; goto pdev_add_fail; } @@ -1292,7 +1284,7 @@ static void __exit lirc_sir_exit(void) drop_port(); platform_device_unregister(lirc_sir_dev); platform_driver_unregister(lirc_sir_driver); - printk(KERN_INFO LIRC_DRIVER_NAME : Uninstalled.\n); + pr_info(Uninstalled.\n); } module_init(lirc_sir_init); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at
[PATCH] staging/media: Use dev_ printks in lirc/igorplugusb.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ... - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_igorplugusb.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index 939a801..2faa391 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -223,8 +223,8 @@ static int unregister_from_lirc(struct igorplug *ir) int devnum; if (!ir) { - printk(KERN_ERR %s: called with NULL device struct!\n, - __func__); + dev_err(ir-usbdev-dev, + %s: called with NULL device struct!\n, __func__); return -EINVAL; } @@ -232,8 +232,8 @@ static int unregister_from_lirc(struct igorplug *ir) d = ir-d; if (!d) { - printk(KERN_ERR %s: called with NULL lirc driver struct!\n, - __func__); + dev_err(ir-usbdev-dev, + %s: called with NULL lirc driver struct!\n, __func__); return -EINVAL; } @@ -347,8 +347,8 @@ static int igorplugusb_remote_poll(void *data, struct lirc_buffer *buf) if (ir-buf_in[2] == 0) send_fragment(ir, buf, DEVICE_HEADERLEN, ret); else { - printk(KERN_WARNING DRIVER_NAME - [%d]: Device buffer overrun.\n, ir-devnum); + dev_warn(ir-usbdev-dev, +[%d]: Device buffer overrun.\n, ir-devnum); /* HHHNNN H = header ---[2]--- N = newer -ret O = older */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/5] ARM: zynq: add clk binding support to the ttc
Add support for retrieving TTC configuration from device tree. This includes the ability to pull information about the driving clocks from the of_clk bindings. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- arch/arm/boot/dts/zynq-7000.dtsi | 53 arch/arm/boot/dts/zynq-zc702.dts | 10 ++ arch/arm/mach-zynq/timer.c | 287 ++- 3 files changed, 228 insertions(+), 122 deletions(-) diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index c975c2d..5914b56 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -109,5 +109,58 @@ }; }; }; + + ttc0: ttc0@f8001000 { + #address-cells = 1; + #size-cells = 0; + compatible = xlnx,ttc; + reg = 0xF8001000 0x1000; + clocks = cpu_clk 3; + clock-names = cpu_1x; + clock-ranges; + + ttc0_0: ttc0.0 { + status = disabled; + reg = 0; + interrupts = 0 10 4; + }; + ttc0_1: ttc0.1 { + status = disabled; + reg = 1; + interrupts = 0 11 4; + }; + ttc0_2: ttc0.2 { + status = disabled; + reg = 2; + interrupts = 0 12 4; + }; + }; + + ttc1: ttc1@f8002000 { + #interrupt-parent = intc; + #address-cells = 1; + #size-cells = 0; + compatible = xlnx,ttc; + reg = 0xF8002000 0x1000; + clocks = cpu_clk 3; + clock-names = cpu_1x; + clock-ranges; + + ttc1_0: ttc1.0 { + status = disabled; + reg = 0; + interrupts = 0 37 4; + }; + ttc1_1: ttc1.1 { + status = disabled; + reg = 1; + interrupts = 0 38 4; + }; + ttc1_2: ttc1.2 { + status = disabled; + reg = 2; + interrupts = 0 39 4; + }; + }; }; }; diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts index 86f44d5..c772942 100644 --- a/arch/arm/boot/dts/zynq-zc702.dts +++ b/arch/arm/boot/dts/zynq-zc702.dts @@ -32,3 +32,13 @@ ps_clk { clock-frequency = 3330; }; + +ttc0_0 { + status = ok; + compatible = xlnx,ttc-counter-clocksource; +}; + +ttc0_1 { + status = ok; + compatible = xlnx,ttc-counter-clockevent; +}; diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c index c93cbe5..9662306 100644 --- a/arch/arm/mach-zynq/timer.c +++ b/arch/arm/mach-zynq/timer.c @@ -23,31 +23,15 @@ #include linux/clocksource.h #include linux/clockchips.h #include linux/io.h +#include linux/of.h +#include linux/of_address.h +#include linux/of_irq.h +#include linux/slab.h +#include linux/clk-provider.h #include mach/zynq_soc.h #include common.h -#define IRQ_TIMERCOUNTER0 42 - -/* - * This driver configures the 2 16-bit count-up timers as follows: - * - * T1: Timer 1, clocksource for generic timekeeping - * T2: Timer 2, clockevent source for hrtimers - * T3: Timer 3, unused - * - * The input frequency to the timer module for emulation is 2.5MHz which is - * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32, - * the timers are clocked at 78.125KHz (12.8 us resolution). - * - * The input frequency to the timer module in silicon will be 200MHz. With the - * pre-scaler of 32, the timers are clocked at 6.25MHz (160ns resolution). - */ -#define XTTCPSS_CLOCKSOURCE0 /* Timer 1 as a generic timekeeping */ -#define XTTCPSS_CLOCKEVENT 1 /* Timer 2 as a clock event */ - -#define XTTCPSS_TIMER_BASE TTC0_BASE -#define XTTCPCC_EVENT_TIMER_IRQ(IRQ_TIMERCOUNTER0 + 1) /* * Timer Register Offset Definitions of Timer 1, Increment base address by 4 * and use same offsets for Timer 2 @@ -64,9 +48,14 @@ #define XTTCPSS_CNT_CNTRL_DISABLE_MASK 0x1 -/* Setup the timers to use pre-scaling */ - -#define TIMER_RATE (PERIPHERAL_CLOCK_RATE / 32) +/* Setup the timers to use pre-scaling, using a fixed value for now that will + * work across most input frequency, but
[PATCH] staging/media: Use pr_ printks in lirc/lirc_bt829.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_bt829.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 951007a..4a3b1f5 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/module.h #include linux/threads.h @@ -72,20 +74,19 @@ static struct pci_dev *do_pci_probe(void) my_dev = pci_get_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_264VT, NULL); if (my_dev) { - printk(KERN_ERR DRIVER_NAME : Using device: %s\n, - pci_name(my_dev)); + pr_err(Using device: %s\n, pci_name(my_dev)); pci_addr_phys = 0; if (my_dev-resource[0].flags IORESOURCE_MEM) { pci_addr_phys = my_dev-resource[0].start; - printk(KERN_INFO DRIVER_NAME : memory at 0x%08X\n, + pr_info(memory at 0x%08X\n, (unsigned int)pci_addr_phys); } if (pci_addr_phys == 0) { - printk(KERN_ERR DRIVER_NAME : no memory resource ?\n); + pr_err(no memory resource ?\n); return NULL; } } else { - printk(KERN_ERR DRIVER_NAME : pci_probe failed\n); + pr_err(pci_probe failed\n); return NULL; } return my_dev; @@ -140,7 +141,7 @@ int init_module(void) atir_minor = lirc_register_driver(atir_driver); if (atir_minor 0) { - printk(KERN_ERR DRIVER_NAME : failed to register driver!\n); + pr_err(failed to register driver!\n); return atir_minor; } dprintk(driver is registered on minor %d\n, atir_minor); @@ -159,7 +160,7 @@ static int atir_init_start(void) { pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF, 0x400); if (pci_addr_lin == 0) { - printk(KERN_INFO DRIVER_NAME : pci mem must be mapped\n); + pr_info(pci mem must be mapped\n); return 0; } return 1; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging/media: Use pr_ printks in lirc/lirc_parallel.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ... - WARNING: Prefer netdev_notice(netdev, ... then dev_notice(dev, ... then pr_notice(... to printk(KERN_NOTICE ... - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_parallel.c | 49 +++- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index dd2bca7..139920c 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -22,6 +22,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + /*** Includes ***/ #include linux/module.h @@ -115,8 +117,7 @@ static void out(int offset, int value) parport_write_control(pport, value); break; case LIRC_LP_STATUS: - printk(KERN_INFO %s: attempt to write to status register\n, - LIRC_DRIVER_NAME); + pr_info(attempt to write to status register\n); break; } } @@ -166,27 +167,23 @@ static unsigned int init_lirc_timer(void) if (default_timer == 0) { /* autodetect timer */ newtimer = (100*count)/timeelapsed; - printk(KERN_INFO %s: %u Hz timer detected\n, - LIRC_DRIVER_NAME, newtimer); + pr_info(%u Hz timer detected\n, newtimer); return newtimer; } else { newtimer = (100*count)/timeelapsed; if (abs(newtimer - default_timer) default_timer/10) { /* bad timer */ - printk(KERN_NOTICE %s: bad timer: %u Hz\n, - LIRC_DRIVER_NAME, newtimer); - printk(KERN_NOTICE %s: using default timer: - %u Hz\n, - LIRC_DRIVER_NAME, default_timer); + pr_notice(bad timer: %u Hz\n, newtimer); + pr_notice(using default timer: %u Hz\n, + default_timer); return default_timer; } else { - printk(KERN_INFO %s: %u Hz timer detected\n, - LIRC_DRIVER_NAME, newtimer); + pr_info(%u Hz timer detected\n, newtimer); return newtimer; /* use detected value */ } } } else { - printk(KERN_NOTICE %s: no timer detected\n, LIRC_DRIVER_NAME); + pr_notice(no timer detected\n); return 0; } } @@ -194,13 +191,10 @@ static unsigned int init_lirc_timer(void) static int lirc_claim(void) { if (parport_claim(ppdevice) != 0) { - printk(KERN_WARNING %s: could not claim port\n, - LIRC_DRIVER_NAME); - printk(KERN_WARNING %s: waiting for port becoming available - \n, LIRC_DRIVER_NAME); + pr_warn(could not claim port\n); + pr_warn(waiting for port becoming available\n); if (parport_claim_or_block(ppdevice) 0) { - printk(KERN_NOTICE %s: could not claim port, giving - up\n, LIRC_DRIVER_NAME); + pr_notice(could not claim port, giving up\n); return 0; } } @@ -219,7 +213,7 @@ static void rbuf_write(int signal) if (nwptr == rptr) { /* no new signals will be accepted */ lost_irqs++; - printk(KERN_NOTICE %s: buffer overrun\n, LIRC_DRIVER_NAME); + pr_notice(buffer overrun\n); return; } rbuf[wptr] = signal; @@ -290,7 +284,7 @@ static void irq_handler(void *blah) if (signal timeout || (check_pselecd (in(1) LP_PSELECD))) { signal = 0; - printk(KERN_NOTICE %s: timeout\n, LIRC_DRIVER_NAME); + pr_notice(timeout\n); break; } } while (lirc_get_signal()); @@ -644,8 +638,7 @@ static int __init lirc_parallel_init(void) result = platform_driver_register(lirc_parallel_driver); if (result) { - printk(KERN_NOTICE platform_driver_register -returned %d\n, result); +
[RFC PATCH] mm: trace filemap add and del
Use the events API to trace filemap loading and unloading of file pieces into the page cache. This patch aims at tracing the eviction reload cycle of executable and shared libraries pages in a memory constrained environment. The typical usage is to spot a specific device and inode (for example /lib/libc.so) to see the eviction cycles, and find out if frequently used code is rather spread across many pages (bad) or coallesced (good). Signed-off-by: Robert Jarzmik robert.jarz...@free.fr --- include/trace/events/filemap.h | 79 mm/filemap.c |5 +++ 2 files changed, 84 insertions(+) create mode 100644 include/trace/events/filemap.h diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h new file mode 100644 index 000..a8319e2 --- /dev/null +++ b/include/trace/events/filemap.h @@ -0,0 +1,79 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM filemap + +#if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FILEMAP_H + +#include linux/types.h +#include linux/tracepoint.h +#include linux/mm.h +#include linux/memcontrol.h +#include linux/device.h +#include linux/kdev_t.h + +TRACE_EVENT(mm_filemap_delete_from_page_cache, + + TP_PROTO(struct page *page), + + TP_ARGS(page), + + TP_STRUCT__entry( + __field(struct page *, page) + __field(unsigned long, i_no) + __field(unsigned long, pageofs) + __field(dev_t, s_dev) + ), + + TP_fast_assign( + __entry-page = page; + __entry-i_no = page-mapping-host-i_ino; + __entry-pageofs = page-index; + if (page-mapping-host-i_sb) + __entry-s_dev = page-mapping-host-i_sb-s_dev; + else + __entry-s_dev = page-mapping-host-i_rdev; + ), + + TP_printk(page=%p pfn=%lu blk=%d:%d inode+ofs=%lu+%lu, + __entry-page, + page_to_pfn(__entry-page), + MAJOR(__entry-s_dev), MINOR(__entry-s_dev), + __entry-i_no, + __entry-pageofs PAGE_SHIFT) +); + +TRACE_EVENT(mm_filemap_add_to_page_cache, + + TP_PROTO(struct page *page), + + TP_ARGS(page), + + TP_STRUCT__entry( + __field(struct page *, page) + __field(unsigned long, i_no) + __field(unsigned long, pageofs) + __field(dev_t, s_dev) + ), + + TP_fast_assign( + __entry-page = page; + __entry-i_no = page-mapping-host-i_ino; + __entry-pageofs = page-index; + if (page-mapping-host-i_sb) + __entry-s_dev = page-mapping-host-i_sb-s_dev; + else + __entry-s_dev = page-mapping-host-i_rdev; + ), + + TP_printk(page=%p pfn=%lu blk=%d:%d inode+ofs=%lu+%lu, + __entry-page, + page_to_pfn(__entry-page), + MAJOR(__entry-s_dev), MINOR(__entry-s_dev), + __entry-i_no, + __entry-pageofs) +); + +#endif /* _TRACE_FILEMAP_H */ + +/* This part must be outside protection */ +#include trace/define_trace.h diff --git a/mm/filemap.c b/mm/filemap.c index 3843445..9753b7c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -35,6 +35,9 @@ #include linux/cleancache.h #include internal.h +#define CREATE_TRACE_POINTS +#include trace/events/filemap.h + /* * FIXME: remove all knowledge of the buffer layer from the core VM */ @@ -113,6 +116,7 @@ void __delete_from_page_cache(struct page *page) { struct address_space *mapping = page-mapping; + trace_mm_filemap_delete_from_page_cache(page); /* * if we're uptodate, flush out into the cleancache, otherwise * invalidate any existing cleancache entries. We can't leave @@ -467,6 +471,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping, } else { page-mapping = NULL; /* Leave page-index set: truncation relies upon it */ + trace_mm_filemap_add_to_page_cache(page); spin_unlock_irq(mapping-tree_lock); mem_cgroup_uncharge_cache_page(page); page_cache_release(page); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/5] serial: xilinx_uartps: get clock rate info from dts
Add support for specifying clock information for the uart clk via the device tree. This eliminates the need to hardcode rates in the device tree. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- arch/arm/boot/dts/zynq-7000.dtsi | 4 ++-- drivers/tty/serial/xilinx_uartps.c | 30 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index bb3085c..c975c2d 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -44,14 +44,14 @@ compatible = xlnx,xuartps; reg = 0xE000 0x1000; interrupts = 0 27 4; - clock = 5000; + clocks = uart_clk 0; }; uart1: uart@e0001000 { compatible = xlnx,xuartps; reg = 0xE0001000 0x1000; interrupts = 0 50 4; - clock = 5000; + clocks = uart_clk 1; }; slcr: slcr@f800 { diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 23efe17..adfecbc 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -17,6 +17,7 @@ #include linux/tty.h #include linux/tty_flip.h #include linux/console.h +#include linux/clk.h #include linux/irq.h #include linux/io.h #include linux/of.h @@ -944,18 +945,20 @@ static int __devinit xuartps_probe(struct platform_device *pdev) int rc; struct uart_port *port; struct resource *res, *res2; - int clk = 0; + struct clk *clk; - const unsigned int *prop; - - prop = of_get_property(pdev-dev.of_node, clock, NULL); - if (prop) - clk = be32_to_cpup(prop); + clk = of_clk_get(pdev-dev.of_node, 0); if (!clk) { dev_err(pdev-dev, no clock specified\n); return -ENODEV; } + rc = clk_prepare_enable(clk); + if (rc) { + dev_err(pdev-dev, could not enable clock\n); + return -EBUSY; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; @@ -978,7 +981,8 @@ static int __devinit xuartps_probe(struct platform_device *pdev) port-mapbase = res-start; port-irq = res2-start; port-dev = pdev-dev; - port-uartclk = clk; + port-uartclk = clk_get_rate(clk); + port-private_data = clk; dev_set_drvdata(pdev-dev, port); rc = uart_add_one_port(xuartps_uart_driver, port); if (rc) { @@ -1000,14 +1004,14 @@ static int __devinit xuartps_probe(struct platform_device *pdev) static int __devexit xuartps_remove(struct platform_device *pdev) { struct uart_port *port = dev_get_drvdata(pdev-dev); - int rc = 0; + struct clk *clk = port-private_data; + int rc; /* Remove the xuartps port from the serial core */ - if (port) { - rc = uart_remove_one_port(xuartps_uart_driver, port); - dev_set_drvdata(pdev-dev, NULL); - port-mapbase = 0; - } + rc = uart_remove_one_port(xuartps_uart_driver, port); + dev_set_drvdata(pdev-dev, NULL); + port-mapbase = 0; + clk_disable_unprepare(clk); return rc; } -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging/media: Use dev_ or pr_ printks in lirc/lirc_imon.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_imon.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 2944fde..343c622 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -20,6 +20,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/errno.h #include linux/init.h #include linux/kernel.h @@ -205,12 +207,12 @@ static void deregister_from_lirc(struct imon_context *context) retval = lirc_unregister_driver(minor); if (retval) - printk(KERN_ERR KBUILD_MODNAME - : %s: unable to deregister from lirc(%d), - __func__, retval); + dev_err(context-usbdev-dev, + : %s: unable to deregister from lirc(%d), + __func__, retval); else - printk(KERN_INFO MOD_NAME : Deregistered iMON driver - (minor:%d)\n, minor); + dev_info(context-usbdev-dev, +Deregistered iMON driver (minor:%d)\n, minor); } @@ -231,8 +233,7 @@ static int display_open(struct inode *inode, struct file *file) subminor = iminor(inode); interface = usb_find_interface(imon_driver, subminor); if (!interface) { - printk(KERN_ERR KBUILD_MODNAME - : %s: could not find interface for minor %d\n, + pr_err(%s: could not find interface for minor %d\n, __func__, subminor); retval = -ENODEV; goto exit; @@ -282,8 +283,7 @@ static int display_close(struct inode *inode, struct file *file) context = file-private_data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return -ENODEV; } @@ -391,8 +391,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, context = file-private_data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return -ENODEV; } @@ -521,8 +520,7 @@ static void ir_close(void *data) context = (struct imon_context *)data; if (!context) { - printk(KERN_ERR KBUILD_MODNAME - %s: no context for device\n, __func__); + pr_err(%s: no context for device\n, __func__); return; } @@ -1009,8 +1007,8 @@ static void imon_disconnect(struct usb_interface *interface) mutex_unlock(driver_lock); - printk(KERN_INFO %s: iMON device (intf%d) disconnected\n, - __func__, ifnum); + dev_info(interface-dev, %s: iMON device (intf%d) disconnected\n, +__func__, ifnum); } static int imon_suspend(struct usb_interface *intf, pm_message_t message) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging/media: Use pr_ printks in lirc/lirc_serial.c
fixed below checkpatch warnings. - WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ... - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... - WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... and add pr_fmt. Signed-off-by: YAMANE Toshiaki yamaneto...@gmail.com --- drivers/staging/media/lirc/lirc_serial.c | 70 +- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 97ef670..89e2820 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -48,6 +48,8 @@ * Steve Davies st...@daviesfam.org July 2001 */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/module.h #include linux/errno.h #include linux/signal.h @@ -667,8 +669,7 @@ static irqreturn_t irq_handler(int i, void *blah) counter++; status = sinp(UART_MSR); if (counter RS_ISR_PASS_LIMIT) { - printk(KERN_WARNING LIRC_DRIVER_NAME : AI: - We're caught!\n); + pr_warn(AI: We're caught!\n); break; } if ((status hardware[type].signal_pin_change) @@ -703,11 +704,10 @@ static irqreturn_t irq_handler(int i, void *blah) dcd = (status hardware[type].signal_pin) ? 1 : 0; if (dcd == last_dcd) { - printk(KERN_WARNING LIRC_DRIVER_NAME - : ignoring spike: %d %d %lx %lx %lx %lx\n, - dcd, sense, - tv.tv_sec, lasttv.tv_sec, - tv.tv_usec, lasttv.tv_usec); + pr_warn(ignoring spike: %d %d %lx %lx %lx %lx\n, + dcd, sense, + tv.tv_sec, lasttv.tv_sec, + tv.tv_usec, lasttv.tv_usec); continue; } @@ -715,25 +715,20 @@ static irqreturn_t irq_handler(int i, void *blah) if (tv.tv_sec lasttv.tv_sec || (tv.tv_sec == lasttv.tv_sec tv.tv_usec lasttv.tv_usec)) { - printk(KERN_WARNING LIRC_DRIVER_NAME - : AI: your clock just jumped - backwards\n); - printk(KERN_WARNING LIRC_DRIVER_NAME - : %d %d %lx %lx %lx %lx\n, - dcd, sense, - tv.tv_sec, lasttv.tv_sec, - tv.tv_usec, lasttv.tv_usec); + pr_warn(AI: your clock just jumped backwards\n); + pr_warn(%d %d %lx %lx %lx %lx\n, + dcd, sense, + tv.tv_sec, lasttv.tv_sec, + tv.tv_usec, lasttv.tv_usec); data = PULSE_MASK; } else if (deltv 15) { data = PULSE_MASK; /* really long time */ if (!(dcd^sense)) { /* sanity check */ - printk(KERN_WARNING LIRC_DRIVER_NAME - : AI: - %d %d %lx %lx %lx %lx\n, - dcd, sense, - tv.tv_sec, lasttv.tv_sec, - tv.tv_usec, lasttv.tv_usec); + pr_warn(AI: %d %d %lx %lx %lx %lx\n, + dcd, sense, + tv.tv_sec, lasttv.tv_sec, + tv.tv_usec, lasttv.tv_usec); /* * detecting pulse while this * MUST be a space! @@ -776,8 +771,7 @@ static int hardware_init_port(void) soutp(UART_IER, scratch); if (scratch2 != 0 || scratch3 != 0x0f) { /* we fail, there's nothing here */ - printk(KERN_ERR LIRC_DRIVER_NAME : port existence test - failed, cannot continue\n); + pr_err(port existence test failed, cannot continue\n); return -ENODEV; } @@
[PATCH v2 2/5] clk: Add support for fundamental zynq clks
Provide simplified models for the necessary clocks on the zynq-7000 platform. Currently, the PLLs, the CPU clock network, and the basic peripheral clock networks (for SDIO, SMC, SPI, QSPI, UART) are modelled. OF bindings are also provided and documented. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- .../devicetree/bindings/clock/zynq-7000.txt| 55 +++ drivers/clk/clk-zynq.c | 383 + include/linux/clk/zynq.h | 24 ++ 3 files changed, 462 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/zynq-7000.txt create mode 100644 drivers/clk/clk-zynq.c create mode 100644 include/linux/clk/zynq.h diff --git a/Documentation/devicetree/bindings/clock/zynq-7000.txt b/Documentation/devicetree/bindings/clock/zynq-7000.txt new file mode 100644 index 000..23ae1db --- /dev/null +++ b/Documentation/devicetree/bindings/clock/zynq-7000.txt @@ -0,0 +1,55 @@ +Device Tree Clock bindings for the Zynq 7000 EPP + +The Zynq EPP has several different clk providers, each with there own bindings. +The purpose of this document is to document their usage. + +See clock_bindings.txt for more information on the generic clock bindings. +See Chapter 25 of Zynq TRM for more information about Zynq clocks. + +== PLLs == + +Used to describe the ARM_PLL, DDR_PLL, and IO_PLL. + +Required properties: +- #clock-cells : shall be 0 (only one clock is output from this node) +- compatible : xlnx,zynq-pll +- reg : pair of u32 values, which are the address offsets within the SLCR +of the relevant PLL_CTRL register and PLL_CFG register respectively +- clocks : phandle for parent clock. should be the phandle for ps_clk + +Optional properties: +- clock-output-names : name of the output clock + +Example: + armpll: armpll { + #clock-cells = 0; + compatible = xlnx,zynq-pll; + clocks = ps_clk; + reg = 0x100 0x110; + clock-output-names = armpll; + }; + +== Peripheral clocks == + +Describes clock node for the SDIO, SMC, SPI, QSPI, and UART clocks. + +Required properties: +- #clock-cells : shall be 1 +- compatible : xlnx,zynq-periph-clock +- reg : a single u32 value, describing the offset within the SLCR where +the CLK_CTRL register is found for this peripheral +- clocks : phandle for parent clocks. should hold phandles for + the IO_PLL, ARM_PLL, and DDR_PLL in order +- clock-output-names : names of the output clock(s). For peripherals that have + two output clocks (for example, the UART), two clocks + should be listed. + +Example: + uart_clk: uart_clk { + #clock-cells = 1; + compatible = xlnx,zynq-periph-clock; + clocks = iopll armpll ddrpll; + reg = 0x154; + clock-output-names = uart0_ref_clk, +uart1_ref_clk; + }; diff --git a/drivers/clk/clk-zynq.c b/drivers/clk/clk-zynq.c new file mode 100644 index 000..de8b586 --- /dev/null +++ b/drivers/clk/clk-zynq.c @@ -0,0 +1,383 @@ +/* + * Copyright (c) 2012 National Instruments + * + * Josh Cartwright josh.cartwri...@ni.com + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see http://www.gnu.org/licenses/. + */ +#include linux/io.h +#include linux/of.h +#include linux/slab.h +#include linux/kernel.h +#include linux/clk-provider.h + +static void __iomem *slcr_base; + +struct zynq_pll_clk { + struct clk_hw hw; + void __iomem*pll_ctrl; + void __iomem*pll_cfg; +}; + +#define to_zynq_pll_clk(hw)container_of(hw, struct zynq_pll_clk, hw) + +#define CTRL_PLL_FDIV(x) ((x) 12) + +static unsigned long zynq_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct zynq_pll_clk *pll = to_zynq_pll_clk(hw); + return parent_rate * CTRL_PLL_FDIV(ioread32(pll-pll_ctrl)); +} + +static const struct clk_ops zynq_pll_clk_ops = { + .recalc_rate= zynq_pll_recalc_rate, +}; + +static void __init zynq_pll_clk_setup(struct device_node *np) +{ + struct clk_init_data init; + struct zynq_pll_clk *pll; + const char *parent_name; + struct clk *clk; + u32 regs[2]; + int ret; + + ret = of_property_read_u32_array(np, reg, regs, ARRAY_SIZE(regs)); + if (WARN_ON(ret)) +
[PATCH v2 0/5] zynq clk support
This set is a v2 of my original patchset zynq COMMON_CLK support [1]. This patchset is on top of the arm-next in the Xilinx tree[2], and also dependent on my patch serial: xilinx_uartps: kill CONFIG_OF conditional, which I've removed from this patchset at Michal Simek's request. For easy testing, I've made available a branch with my changes here[3]. Changes since v1: - Dropped the moving of the TTC driver. This will be done in a later patchset. - Fixed TTC periodic tick frequency calculation - Updated basic peripheral clk to support devices with less than two derivative clks. - Fixed dts issues in the uart and ttc (thanks to Lars-Peter Clausen and Michal Simek). - Split out the creation of the clk drivers and the enabling of the drivers for the platform into separate patches. - Updated clk initialization functions to 'bail out' when an error condition is hit. - Addressed stylistic feedback from Lars-Peter Clausen. --- Patch 1 performs a dts file split for zynq, creating a generic zynq-7000.dtsi snippet and a zynq-zc702.dts board specific description. Patch 2 introduces the zynq clock drivers and bindings. Patch 3 enables the zynq clock drivers when building for zynq, and adds updates the zynq device trees to use the bindings. Patch 4 updates the xilinx uartps driver to acquire rate information via the clk bindings. Patch 5 updates the xilinx ttc driver to acquire rate information via the clk bindings. --- [1]: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-October/129295.html [2]: git://git.xilinx.com/linux-xlnx.git#arm-next [3]: git://gi.teric.us/linux-zynq.git#of_clk_v2 --- Josh Cartwright (5): ARM: zynq: dts: split up device tree clk: Add support for fundamental zynq clks ARM: zynq: use zynq clk bindings serial: xilinx_uartps: get clock rate info from dts ARM: zynq: add clk binding support to the ttc .../devicetree/bindings/clock/zynq-7000.txt| 55 +++ arch/arm/Kconfig | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/zynq-7000.dtsi | 166 + arch/arm/boot/dts/zynq-ep107.dts | 70 arch/arm/boot/dts/zynq-zc702.dts | 44 +++ arch/arm/mach-zynq/common.c| 14 +- arch/arm/mach-zynq/timer.c | 287 --- drivers/clk/Makefile | 1 + drivers/clk/clk-zynq.c | 383 + drivers/tty/serial/xilinx_uartps.c | 30 +- include/linux/clk/zynq.h | 24 ++ 12 files changed, 870 insertions(+), 206 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/zynq-7000.txt create mode 100644 arch/arm/boot/dts/zynq-7000.dtsi delete mode 100644 arch/arm/boot/dts/zynq-ep107.dts create mode 100644 arch/arm/boot/dts/zynq-zc702.dts create mode 100644 drivers/clk/clk-zynq.c create mode 100644 include/linux/clk/zynq.h -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/5] ARM: zynq: dts: split up device tree
The purpose of the created zynq-7000.dtsi file is to describe the hardware common to all Zynq 7000-based boards. Also, get rid of the zynq-ep107 device tree, since it is not hardware anyone can purchase. Add a zc702 dts file based on the zynq-7000.dtsi. Add it to the dts/Makefile so it is built with the 'dtbs' target. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- arch/arm/boot/dts/Makefile | 1 + .../boot/dts/{zynq-ep107.dts = zynq-7000.dtsi}| 19 +++--- arch/arm/boot/dts/zynq-zc702.dts | 30 ++ arch/arm/mach-zynq/common.c| 3 ++- 4 files changed, 36 insertions(+), 17 deletions(-) rename arch/arm/boot/dts/{zynq-ep107.dts = zynq-7000.dtsi} (79%) create mode 100644 arch/arm/boot/dts/zynq-zc702.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index f37cf9f..76ed11e 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -103,5 +103,6 @@ dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ wm8505-ref.dtb \ wm8650-mid.dtb +dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb endif diff --git a/arch/arm/boot/dts/zynq-ep107.dts b/arch/arm/boot/dts/zynq-7000.dtsi similarity index 79% rename from arch/arm/boot/dts/zynq-ep107.dts rename to arch/arm/boot/dts/zynq-7000.dtsi index 5caf100..8b30e59 100644 --- a/arch/arm/boot/dts/zynq-ep107.dts +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -10,29 +10,16 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ +/include/ skeleton.dtsi -/dts-v1/; / { - model = Xilinx Zynq EP107; - compatible = xlnx,zynq-ep107; - #address-cells = 1; - #size-cells = 1; - interrupt-parent = intc; - - memory { - device_type = memory; - reg = 0x0 0x1000; - }; - - chosen { - bootargs = console=ttyPS0,9600 root=/dev/ram rw initrd=0x80,8M earlyprintk; - linux,stdout-path = uart0; - }; + compatible = xlnx,zynq-7000; amba { compatible = simple-bus; #address-cells = 1; #size-cells = 1; + interrupt-parent = intc; ranges; intc: interrupt-controller@f8f01000 { diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts new file mode 100644 index 000..e25a307 --- /dev/null +++ b/arch/arm/boot/dts/zynq-zc702.dts @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2011 Xilinx + * Copyright (C) 2012 National Instruments Corp. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/dts-v1/; +/include/ zynq-7000.dtsi + +/ { + model = Zynq ZC702 Development Board; + compatible = xlnx,zynq-zc702, xlnx,zynq-7000; + + memory { + device_type = memory; + reg = 0x0 0x4000; + }; + + chosen { + bootargs = console=ttyPS1,115200 earlyprintk; + }; + +}; diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index f0eef84..5441323 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -115,7 +115,8 @@ static void __init xilinx_map_io(void) } static const char *xilinx_dt_match[] = { - xlnx,zynq-ep107, + xlnx,zynq-zc702, + xlnx,zynq-7000, NULL }; -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/5] ARM: zynq: use zynq clk bindings
Make the Zynq platform use the newly created zynq clk bindings. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- arch/arm/Kconfig | 1 + arch/arm/boot/dts/zynq-7000.dtsi | 56 arch/arm/boot/dts/zynq-zc702.dts | 4 +++ arch/arm/mach-zynq/common.c | 11 drivers/clk/Makefile | 1 + 5 files changed, 73 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 21ed87b..ccfe0ab 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -959,6 +959,7 @@ config ARCH_ZYNQ bool Xilinx Zynq ARM Cortex A9 Platform select ARM_AMBA select ARM_GIC + select COMMON_CLK select CPU_V7 select GENERIC_CLOCKEVENTS select ICST diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 8b30e59..bb3085c 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -53,5 +53,61 @@ interrupts = 0 50 4; clock = 5000; }; + + slcr: slcr@f800 { + compatible = xlnx,zynq-slcr; + reg = 0xF800 0x1000; + + clocks { + #address-cells = 1; + #size-cells = 0; + + ps_clk: ps_clk { + #clock-cells = 0; + compatible = fixed-clock; + /* clock-frequency set in board-specific file */ + clock-output-names = ps_clk; + }; + armpll: armpll { + #clock-cells = 0; + compatible = xlnx,zynq-pll; + clocks = ps_clk; + reg = 0x100 0x110; + clock-output-names = armpll; + }; + ddrpll: ddrpll { + #clock-cells = 0; + compatible = xlnx,zynq-pll; + clocks = ps_clk; + reg = 0x104 0x114; + clock-output-names = ddrpll; + }; + iopll: iopll { + #clock-cells = 0; + compatible = xlnx,zynq-pll; + clocks = ps_clk; + reg = 0x108 0x118; + clock-output-names = iopll; + }; + uart_clk: uart_clk { + #clock-cells = 1; + compatible = xlnx,zynq-periph-clock; + clocks = iopll armpll ddrpll; + reg = 0x154; + clock-output-names = uart0_ref_clk, +uart1_ref_clk; + }; + cpu_clk: cpu_clk { + #clock-cells = 1; + compatible = xlnx,zynq-cpu-clock; + clocks = iopll armpll ddrpll; + reg = 0x120 0x1C4; + clock-output-names = cpu_6x4x, +cpu_3x2x, +cpu_2x, +cpu_1x; + }; + }; + }; }; }; diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts index e25a307..86f44d5 100644 --- a/arch/arm/boot/dts/zynq-zc702.dts +++ b/arch/arm/boot/dts/zynq-zc702.dts @@ -28,3 +28,7 @@ }; }; + +ps_clk { + clock-frequency = 3330; +}; diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 5441323..79bf5fb 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -19,6 +19,8 @@ #include linux/cpumask.h #include linux/platform_device.h #include linux/clk.h +#include linux/clk/zynq.h +#include linux/of_address.h #include linux/of_irq.h #include linux/of_platform.h #include linux/of.h @@ -96,6 +98,15 @@ static struct map_desc io_desc[] __initdata = { static void __init xilinx_zynq_timer_init(void) { + struct device_node *np; + void __iomem *slcr; + + np =
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Thu, Nov 08, 2012 at 12:32:25PM -0700, Bjorn Helgaas wrote: Struct device_driver is a generic structure, so it seems strange to have to include non-generic things like of_device_id and now acpi_match_table there. Yes, but in a sense the DT and ACPI are generic. So that they are used to describe the configuration of a machine. I'm actually interested in the details you didn't include above, too. For example, I don't know of a generic way to get resource information from a struct device *, so I assume you need to figure out what sort of device it is and then do the appropriate PCI/ACPI/OF/DT/etc operations to learn the resources? Right. Typically you check, dev-of_node (or dev-acpi_handle) in a driver and if it is non-NULL you can extract the resources using DT or ACPI specific API calls. Some things like IRQs and MMIO addresses can be passed to the driver using the struct resource (and we do that already) but others we can't, like GPIOs and some DT specific properties. Also with ACPI there might be need to call some ACPI method, like _DSM where we need to have access to the ACPI handle. I think it would be cool if there *were* a generic way to get struct device resources. Then you could imagine a mechanism where a driver supplied a list of identifiers it could claim, e.g., PCI_VEN_DEV(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART), ACPI_ID(PNP0501), etc., and it might not need to know anything more than what the identifier is. Indeed that would be cool, and we should probably try to implement something like that, eventually. If you have followed the discusion there is already talks about having a single API to get GPIOs to the driver in a generic way. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: scsi target, likely GPL violation
On Thu, 2012-11-08 at 08:57 -0800, Andy Grover wrote: On 11/07/2012 05:57 PM, Chris Friesen wrote: On 11/07/2012 07:02 PM, Jon Mason wrote: I'm not a lawyer, nor do I play one on TV, but if I understand the GPL correctly, RTS only needs to provide the relevant source to their customers upon request. Not quite. Assuming the GPL applies, and that they have modified the code, then they must either: 1) include the source with the distributed binary or 2) include with the binary an offer to provide the source to *any* third party So you'd have me find one of their customers, and then get the source via your #2 method... ...and then turn around and submit it to Nick since he's the target subsystem maintainer? Nick is probably the one who wrote it! I'm happy to do that, but we should recognize something is seriously skewed when the person nominally in charge of the in-kernel code also has a vested interest in *not* seeing new features added, since it then competes better with his company's offering. RTS is trying to use an open core business model. This works fine for BSD-licensed code or code originally authored entirely by you, but their code (all of it even the new stuff) is a derivative work of the Linux kernel source code, and the GPL says they need to contribute it back. Andy, Accusing us of violating GPL is a serious legal claim. In fact, we are not violating GPL. In short, this is because we wrote the code you are referring to (the SCSI target core in our commercial RTS OS product), we have exclusive copyright ownership of it, and this code contains no GPL code from the community. GPL obligations only apply downstream to licensees, and not to the author of the code. Those who use the code under GPL are subject to its conditions; we are not. As you know, we contributed the Linux SCSI target core, including the relevant interfaces, to the Linux kernel. To be clear, we wrote that code entirely ourselves, so we have the right to use it as we please. The version we use in RTS OS is a different, proprietary version, which we also wrote ourselves. However, the fact that we contributed a version of the code to the Linux kernel does not require us to provide our proprietary version to anyone. If you want to understand better how dual licensing works, perhaps we can talk off list. But we don’t really have a responsibility to respond to untrue accusations, nor to explain GPL, nor discuss our proprietary code. We’re very disappointed that Red Hat would not be more professional in its communications about licensing compliance matters, particularly to a company like ours that has been a major contributor to Linux and therefore also to Red Hat’s own products. So, while I invite you to talk about this with us directly, I also advise you – respectfully – not to make public accusations that are not true. That is harmful to our reputation – and candidly, it doesn’t reflect well on you or your company. --nab -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RESEND v2 1/1] percpu_rw_semaphore: reimplement to not block the readers unnecessarily
On Thu, 8 Nov 2012 14:48:49 +0100 Oleg Nesterov o...@redhat.com wrote: Currently the writer does msleep() plus synchronize_sched() 3 times to acquire/release the semaphore, and during this time the readers are blocked completely. Even if the write section was not actually started or if it was already finished. With this patch down_write/up_write does synchronize_sched() twice and down_read/up_read are still possible during this time, just they use the slow path. percpu_down_write() first forces the readers to use rw_semaphore and increment the slow counter to take the lock for reading, then it takes that rw_semaphore for writing and blocks the readers. Also. With this patch the code relies on the documented behaviour of synchronize_sched(), it doesn't try to pair synchronize_sched() with barrier. ... include/linux/percpu-rwsem.h | 83 + lib/Makefile |2 +- lib/percpu-rwsem.c | 123 ++ The patch also uninlines everything. And it didn't export the resulting symbols to modules, so it isn't an equivalent. We can export thing later if needed I guess. It adds percpu-rwsem.o to lib-y, so the CONFIG_BLOCK=n kernel will avoid including the code altogether, methinks? ... --- /dev/null +++ b/lib/percpu-rwsem.c @@ -0,0 +1,123 @@ That was nice and terse ;) +#include linux/percpu-rwsem.h +#include linux/rcupdate.h +#include linux/sched.h This list is nowhere near sufficient to support this file's requirements. atomic.h, percpu.h, rwsem.h, wait.h, errno.h and plenty more. IOW, if it compiles, it was sheer luck. +int percpu_init_rwsem(struct percpu_rw_semaphore *brw) +{ + brw-fast_read_ctr = alloc_percpu(int); + if (unlikely(!brw-fast_read_ctr)) + return -ENOMEM; + + mutex_init(brw-writer_mutex); + init_rwsem(brw-rw_sem); + atomic_set(brw-slow_read_ctr, 0); + init_waitqueue_head(brw-write_waitq); + return 0; +} + +void percpu_free_rwsem(struct percpu_rw_semaphore *brw) +{ + free_percpu(brw-fast_read_ctr); + brw-fast_read_ctr = NULL; /* catch use after free bugs */ +} + +static bool update_fast_ctr(struct percpu_rw_semaphore *brw, unsigned int val) +{ + bool success = false; + + preempt_disable(); + if (likely(!mutex_is_locked(brw-writer_mutex))) { + __this_cpu_add(*brw-fast_read_ctr, val); + success = true; + } + preempt_enable(); + + return success; +} + +/* + * Like the normal down_read() this is not recursive, the writer can + * come after the first percpu_down_read() and create the deadlock. + */ +void percpu_down_read(struct percpu_rw_semaphore *brw) +{ + if (likely(update_fast_ctr(brw, +1))) + return; + + down_read(brw-rw_sem); + atomic_inc(brw-slow_read_ctr); + up_read(brw-rw_sem); +} + +void percpu_up_read(struct percpu_rw_semaphore *brw) +{ + if (likely(update_fast_ctr(brw, -1))) + return; + + /* false-positive is possible but harmless */ + if (atomic_dec_and_test(brw-slow_read_ctr)) + wake_up_all(brw-write_waitq); +} + +static int clear_fast_ctr(struct percpu_rw_semaphore *brw) +{ + unsigned int sum = 0; + int cpu; + + for_each_possible_cpu(cpu) { + sum += per_cpu(*brw-fast_read_ctr, cpu); + per_cpu(*brw-fast_read_ctr, cpu) = 0; + } + + return sum; +} + +/* + * A writer takes -writer_mutex to exclude other writers and to force the + * readers to switch to the slow mode, note the mutex_is_locked() check in + * update_fast_ctr(). + * + * After that the readers can only inc/dec the slow -slow_read_ctr counter, + * -fast_read_ctr is stable. Once the writer moves its sum into the slow + * counter it represents the number of active readers. + * + * Finally the writer takes -rw_sem for writing and blocks the new readers, + * then waits until the slow counter becomes zero. + */ Some overview of how fast/slow_read_ctr are supposed to work would be useful. This comment seems to assume that the reader already knew that. +void percpu_down_write(struct percpu_rw_semaphore *brw) +{ + /* also blocks update_fast_ctr() which checks mutex_is_locked() */ + mutex_lock(brw-writer_mutex); + + /* + * 1. Ensures mutex_is_locked() is visible to any down_read/up_read + *so that update_fast_ctr() can't succeed. + * + * 2. Ensures we see the result of every previous this_cpu_add() in + *update_fast_ctr(). + * + * 3. Ensures that if any reader has exited its critical section via + *fast-path, it executes a full memory barrier before we return. + */ + synchronize_sched(); Here's where I get horridly confused. Your patch completely deRCUifies this code, yes? Yet here we're using an RCU primitive. And we seem to be
[PATCH 0/3] target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation
From: Nicholas Bellinger n...@linux-iscsi.org Hi folks, This series for-3.8 adds support for proper WRITE_SAME w/ UNMAP=0 emulation for IBLOCK device backends to follow MKP's WRITE_SAME patches that have been merged for v3.7-rc1. Currently it uses a bio_add_page() call for each sector in order to allow scatterlist w/ page offsets to work, as blkdev_issue_write_same() currently assumes underlying hw support + zero page offset. So far it has been tested on target-pending/for-next code with iscsi-target and tcm_loop fabric ports. Please review, --nab Nicholas Bellinger (3): target/sbc: Make WRITE_SAME check differentiate between UNMAP=[1,0] target: Add max_write_same_len device attribute target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation support drivers/target/target_core_configfs.c |4 ++ drivers/target/target_core_device.c | 11 + drivers/target/target_core_iblock.c | 78 +--- drivers/target/target_core_internal.h |1 + drivers/target/target_core_sbc.c | 19 +++- drivers/target/target_core_spc.c |8 +++- include/target/target_core_base.h |4 ++ 7 files changed, 104 insertions(+), 21 deletions(-) -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] target/sbc: Make WRITE_SAME check differentiate between UNMAP=[1,0]
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates sbc_write_same_supported() to set SCF_WRITE_SAME_DISCARD to signal when WRITE_SAME w/ UNMAP=1 is requested. Also, allow WRITE_SAME w/ UNMAP=0 to be passed to backend driver logic. Cc: Christoph Hellwig h...@lst.de Cc: Martin K. Petersen martin.peter...@oracle.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/target/target_core_sbc.c | 19 +++ include/target/target_core_base.h |1 + 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index b802421..ee9fa52 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -235,7 +235,7 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb) return ((unsigned long long)__v2) | (unsigned long long)__v1 32; } -static int sbc_write_same_supported(struct se_device *dev, +static int sbc_write_same_supported(struct se_cmd *cmd, unsigned char *flags) { if ((flags[0] 0x04) || (flags[0] 0x02)) { @@ -244,16 +244,11 @@ static int sbc_write_same_supported(struct se_device *dev, Emulation\n); return -ENOSYS; } - /* -* Currently for the emulated case we only accept -* tpws with the UNMAP=1 bit set. +* UNMAP=1 bit translantes to blkdev_issue_discard() execution */ - if (!(flags[0] 0x08)) { - pr_err(WRITE_SAME w/o UNMAP bit not -supported for Block Discard Emulation\n); - return -ENOSYS; - } + if (flags[0] 0x08) + cmd-se_cmd_flags |= SCF_WRITE_SAME_DISCARD; return 0; } @@ -431,7 +426,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) size = sbc_get_size(cmd, 1); cmd-t_task_lba = get_unaligned_be64(cdb[12]); - if (sbc_write_same_supported(dev, cdb[10]) 0) + if (sbc_write_same_supported(cmd, cdb[10]) 0) return TCM_UNSUPPORTED_SCSI_OPCODE; cmd-execute_cmd = ops-execute_write_same; break; @@ -507,7 +502,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) size = sbc_get_size(cmd, 1); cmd-t_task_lba = get_unaligned_be64(cdb[2]); - if (sbc_write_same_supported(dev, cdb[1]) 0) + if (sbc_write_same_supported(cmd, cdb[1]) 0) return TCM_UNSUPPORTED_SCSI_OPCODE; cmd-execute_cmd = ops-execute_write_same; break; @@ -528,7 +523,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) * Follow sbcr26 with WRITE_SAME (10) and check for the existence * of byte 1 bit 3 UNMAP instead of original reserved field */ - if (sbc_write_same_supported(dev, cdb[1]) 0) + if (sbc_write_same_supported(cmd, cdb[1]) 0) return TCM_UNSUPPORTED_SCSI_OPCODE; cmd-execute_cmd = ops-execute_write_same; break; diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5350f6e..2787b85 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -154,6 +154,7 @@ enum se_cmd_flags_table { SCF_ALUA_NON_OPTIMIZED = 0x8000, SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x0002, SCF_ACK_KREF= 0x0004, + SCF_WRITE_SAME_DISCARD = 0x0008, }; /* struct se_dev_entry-lun_flags and struct se_lun-lun_access */ -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation support
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds support for emulation of WRITE_SAME w/ UNMAP=0 within iblock_execute_write_same() backend code. The emulation uses a bio_add_page() call for each sector, and by default enforces a limit of max_write_same_len=0x (65536) sectors following what scsi_debug reports per default for MAXIMUM WRITE SAME LENGTH. It also sets max_write_same_len to the operational default at setup - iblock_configure_device() time. Cc: Christoph Hellwig h...@lst.de Cc: Martin K. Petersen martin.peter...@oracle.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/target/target_core_iblock.c | 78 +++ 1 files changed, 70 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 53f4501..33a5248 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -151,6 +151,10 @@ static int iblock_configure_device(struct se_device *dev) pr_debug(IBLOCK: BLOCK Discard support available, disabled by default\n); } + /* +* Enable WRITE_SAME emulation for IBLOCK, use scsi_debug.c default +*/ + dev-dev_attrib.max_write_same_len = 0x; if (blk_queue_nonrot(q)) dev-dev_attrib.is_nonrot = 1; @@ -375,22 +379,80 @@ err: return ret; } +static struct bio *iblock_get_bio(struct se_cmd *, sector_t, u32); +static void iblock_submit_bios(struct bio_list *, int); +static void iblock_complete_cmd(struct se_cmd *); + static sense_reason_t iblock_execute_write_same(struct se_cmd *cmd) { struct iblock_dev *ib_dev = IBLOCK_DEV(cmd-se_dev); - int ret; + struct iblock_req *ibr; + struct scatterlist *sg; + struct bio *bio; + struct bio_list list; + sector_t block_lba = cmd-t_task_lba; + unsigned int sectors = spc_get_write_same_sectors(cmd); + int rc; + + if (cmd-se_cmd_flags SCF_WRITE_SAME_DISCARD) { + rc = blkdev_issue_discard(ib_dev-ibd_bd, cmd-t_task_lba, + spc_get_write_same_sectors(cmd), GFP_KERNEL, 0); + if (rc 0) { + pr_warn(blkdev_issue_discard() failed: %d\n, rc); + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + } + target_complete_cmd(cmd, GOOD); + return 0; + } + if (sectors cmd-se_dev-dev_attrib.max_write_same_len) { + pr_warn(WRITE_SAME sectors: %u exceeds max_write_same_len: %u\n, + sectors, cmd-se_dev-dev_attrib.max_write_same_len); + return TCM_INVALID_CDB_FIELD; + } + sg = cmd-t_data_sg[0]; - ret = blkdev_issue_discard(ib_dev-ibd_bd, cmd-t_task_lba, - spc_get_write_same_sectors(cmd), GFP_KERNEL, - 0); - if (ret 0) { - pr_debug(blkdev_issue_discard() failed for WRITE_SAME\n); - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL); + if (!ibr) + goto fail; + cmd-priv = ibr; + + bio = iblock_get_bio(cmd, block_lba, 1); + if (!bio) + goto fail_free_ibr; + + bio_list_init(list); + bio_list_add(list, bio); + + atomic_set(ibr-pending, 1); + + while (sectors) { + while (bio_add_page(bio, sg_page(sg), sg-length, sg-offset) + != sg-length) { + + bio = iblock_get_bio(cmd, block_lba, 1); + if (!bio) + goto fail_put_bios; + + atomic_inc(ibr-pending); + bio_list_add(list, bio); + } + + /* Always in 512 byte units for Linux/Block */ + block_lba += sg-length IBLOCK_LBA_SHIFT; + sectors -= 1; } - target_complete_cmd(cmd, GOOD); + iblock_submit_bios(list, WRITE); return 0; + +fail_put_bios: + while ((bio = bio_list_pop(list))) + bio_put(bio); +fail_free_ibr: + kfree(ibr); +fail: + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; } enum { -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] target: Add max_write_same_len device attribute
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new max_write_same_len device attribute for use with WRITE_SAME w/ UNMAP=0 backend emulation. Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to set the default MAXIMUM WRITE SAME LENGTH value of zero. Cc: Christoph Hellwig h...@lst.de Cc: Martin K. Petersen martin.peter...@oracle.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/target/target_core_configfs.c |4 drivers/target/target_core_device.c | 11 +++ drivers/target/target_core_internal.h |1 + drivers/target/target_core_spc.c |8 +++- include/target/target_core_base.h |3 +++ 5 files changed, 26 insertions(+), 1 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 7b473b6..2b14164 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -676,6 +676,9 @@ SE_DEV_ATTR(unmap_granularity, S_IRUGO | S_IWUSR); DEF_DEV_ATTRIB(unmap_granularity_alignment); SE_DEV_ATTR(unmap_granularity_alignment, S_IRUGO | S_IWUSR); +DEF_DEV_ATTRIB(max_write_same_len); +SE_DEV_ATTR(max_write_same_len, S_IRUGO | S_IWUSR); + CONFIGFS_EATTR_OPS(target_core_dev_attrib, se_dev_attrib, da_group); static struct configfs_attribute *target_core_dev_attrib_attrs[] = { @@ -701,6 +704,7 @@ static struct configfs_attribute *target_core_dev_attrib_attrs[] = { target_core_dev_attrib_max_unmap_block_desc_count.attr, target_core_dev_attrib_unmap_granularity.attr, target_core_dev_attrib_unmap_granularity_alignment.attr, + target_core_dev_attrib_max_write_same_len.attr, NULL, }; diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 599374e..54439bc 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -706,6 +706,16 @@ int se_dev_set_unmap_granularity_alignment( return 0; } +int se_dev_set_max_write_same_len( + struct se_device *dev, + u32 max_write_same_len) +{ + dev-dev_attrib.max_write_same_len = max_write_same_len; + pr_debug(dev[%p]: Set max_write_same_len: %u\n, + dev, dev-dev_attrib.max_write_same_len); + return 0; +} + int se_dev_set_emulate_dpo(struct se_device *dev, int flag) { if (flag != 0 flag != 1) { @@ -1393,6 +1403,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) dev-dev_attrib.unmap_granularity = DA_UNMAP_GRANULARITY_DEFAULT; dev-dev_attrib.unmap_granularity_alignment = DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; + dev-dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; dev-dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS; dev-dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS; diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index bc9c522..93e9c1f 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -24,6 +24,7 @@ int se_dev_set_max_unmap_lba_count(struct se_device *, u32); intse_dev_set_max_unmap_block_desc_count(struct se_device *, u32); intse_dev_set_unmap_granularity(struct se_device *, u32); intse_dev_set_unmap_granularity_alignment(struct se_device *, u32); +intse_dev_set_max_write_same_len(struct se_device *, u32); intse_dev_set_emulate_dpo(struct se_device *, int); intse_dev_set_emulate_fua_write(struct se_device *, int); intse_dev_set_emulate_fua_read(struct se_device *, int); diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 4b3c183..cf1b8bb 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -465,7 +465,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) * Exit now if we don't support TP. */ if (!have_tp) - return 0; + goto max_write_same; /* * Set MAXIMUM UNMAP LBA COUNT @@ -491,6 +491,12 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) if (dev-dev_attrib.unmap_granularity_alignment != 0) buf[32] |= 0x80; /* Set the UGAVALID bit */ + /* +* MAXIMUM WRITE SAME LENGTH +*/ +max_write_same: + put_unaligned_be64(dev-dev_attrib.max_write_same_len, buf[36]); + return 0; } diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 2787b85..1b45879 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -71,6 +71,8 @@ #define DA_UNMAP_GRANULARITY_DEFAULT 0 /* Default unmap_granularity_alignment */ #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 +/* Default max_write_same_len, disabled by default */ +#define DA_MAX_WRITE_SAME_LEN 0 /* Default max transfer length
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Thu, Nov 08, 2012 at 01:46:24AM +0100, Rafael J. Wysocki wrote: On Wednesday, November 07, 2012 03:05:48 PM Mika Westerberg wrote: On Wed, Nov 07, 2012 at 12:14:31PM +0100, Rafael J. Wysocki wrote: So is the idea now that the ACPI core parses the resources and passes them forward via struct acpi_device? I'm just wondering how to proceed with these I2C and SPI enumeration patches. Well, we definitely don't want to duplicate what drivers/pnp/pnpacpi/rsparser.c does, so the idea is to move the code from there to the core in such a way that both the SPI/I2C patches and the PNP layer can use it. Ok. I'll have some prototype code ready shortly, hopefully, and I'll post it in that form for comments (and so that you know what to expect). Sounds good. Thanks! There you go. I haven't even try to compile it, so most likely it breaks things left, right and in between, but I hope it shows the idea. Thanks Rafael! I'll try this tomorrow (we had problems with the HW today so I wasn't able to do any testing). I'll convert the SPI and I2C enumeration patches to use this method. It does a couple of things at the same time, so it should be split into a few simpler patches. First, it moves some code from drivers/pnp/pnpacpi/rsparser.c to a new file drivers/acpi/resource.c and makes pnpacpi use functions from there. Second, it changes acpi_platform.c to use those functions too. Finally, it adds a list of ACPI resources to struct acpi_device and makes acpi_platform.c use that list intead of evaluating _CRS and parsing its output with acpi_walk_resources(). While changing acpi_platform.c I noticed that we had a bug in there, because GSIs were registered for the struct acpi_device object, although they should be registered for the struct platform_device one created by that code. I didn't try to fix that in the patch below, but it generally needs fixing. Good point. I wonder if the acpi_register_gsi() wants a device that is registered to the Linux device framework? At least with the SPI and I2C we generally don't have such until we call i2c_new_device() or spi_add_device() and they are getting passed the IRQ number which should be translated to the Linux IRQ before that... -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: scsi target, likely GPL violation
...and then turn around and submit it to Nick since he's the target subsystem maintainer? Nick is probably the one who wrote it! I'm happy to do that, but we should recognize something is seriously skewed when the person nominally in charge of the in-kernel code also has a vested interest in *not* seeing new features added, since it then competes better with his company's offering. RTS is trying to use an open core business model. This works fine for BSD-licensed code or code originally authored entirely by you, but their code (all of it even the new stuff) is a derivative work of the Linux kernel source code, and the GPL says they need to contribute it back. Andy, Accusing us of violating GPL is a serious legal claim. In fact, we are not violating GPL. In short, this is because we wrote the code you are referring to (the SCSI target core in our commercial RTS OS product), we have exclusive copyright ownership of it, and this code contains no GPL code from the community. GPL obligations only apply downstream to licensees, and not to the author of the code. Those who use the code under GPL are subject to its conditions; we are not. Just to clarify since I'm not a major GPL expert. Are you: a) distributing a Linux kernel b) with a module built against it to be linked into it, whether completely written in house or not? Then the module is under the GPL, if you think you are like nvidia or someone then think again, the corner case they live under is that they don't distribute a Linux kernel with their module *ever*, and they have a clear call for non-derived work status since its 90% the same code as in their Windows drivers. But if you distribute a kernel and a module in one place which I assume RTS OS does, then you are in dangerous territory and could be hit with cease and desist notices, which has happened to people shipping kernels and linked nvidia binary drivers before. Dave. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] vmxnet3: convert BUG_ON(true) into a simple BUG()
Signed-off-by: Sasha Levin sasha.le...@oracle.com --- drivers/net/vmxnet3/vmxnet3_drv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 0ae1bcc..7e9622f 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1922,7 +1922,7 @@ vmxnet3_free_irqs(struct vmxnet3_adapter *adapter) free_irq(adapter-pdev-irq, adapter-netdev); break; default: - BUG_ON(true); + BUG(); } } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: gic: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/common/gic.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index aa52699..f0b8a10 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c @@ -336,10 +336,8 @@ static struct irq_chip gic_chip = { void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) { - if (gic_nr = MAX_GIC_NR) - BUG(); - if (irq_set_handler_data(irq, gic_data[gic_nr]) != 0) - BUG(); + BUG_ON(gic_nr = MAX_GIC_NR); + BUG_ON(irq_set_handler_data(irq, gic_data[gic_nr]) != 0); irq_set_chained_handler(irq, gic_handle_cascade_irq); } @@ -421,8 +419,7 @@ static void gic_dist_save(unsigned int gic_nr) void __iomem *dist_base; int i; - if (gic_nr = MAX_GIC_NR) - BUG(); + BUG_ON(gic_nr = MAX_GIC_NR); gic_irqs = gic_data[gic_nr].gic_irqs; dist_base = gic_data_dist_base(gic_data[gic_nr]); @@ -456,8 +453,7 @@ static void gic_dist_restore(unsigned int gic_nr) unsigned int i; void __iomem *dist_base; - if (gic_nr = MAX_GIC_NR) - BUG(); + BUG_ON(gic_nr = MAX_GIC_NR); gic_irqs = gic_data[gic_nr].gic_irqs; dist_base = gic_data_dist_base(gic_data[gic_nr]); @@ -493,8 +489,7 @@ static void gic_cpu_save(unsigned int gic_nr) void __iomem *dist_base; void __iomem *cpu_base; - if (gic_nr = MAX_GIC_NR) - BUG(); + BUG_ON(gic_nr = MAX_GIC_NR); dist_base = gic_data_dist_base(gic_data[gic_nr]); cpu_base = gic_data_cpu_base(gic_data[gic_nr]); @@ -519,8 +514,7 @@ static void gic_cpu_restore(unsigned int gic_nr) void __iomem *dist_base; void __iomem *cpu_base; - if (gic_nr = MAX_GIC_NR) - BUG(); + BUG_ON(gic_nr = MAX_GIC_NR); dist_base = gic_data_dist_base(gic_data[gic_nr]); cpu_base = gic_data_cpu_base(gic_data[gic_nr]); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: kprobes: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/kernel/kprobes-test.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 1862d8f..0fb370d 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c @@ -1212,8 +1212,7 @@ static int register_test_probe(struct test_probe *probe) { int ret; - if (probe-registered) - BUG(); + BUG_ON(probe-registered); ret = register_kprobe(probe-kprobe); if (ret = 0) { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: versatile: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/mach-versatile/pci.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c index 2f84f40..3936a11 100644 --- a/arch/arm/mach-versatile/pci.c +++ b/arch/arm/mach-versatile/pci.c @@ -82,12 +82,9 @@ static void __iomem *__pci_addr(struct pci_bus *bus, /* * Trap out illegal values */ - if (offset 255) - BUG(); - if (busnr 255) - BUG(); - if (devfn 255) - BUG(); + BUG_ON(offset 255); + BUG_ON(busnr 255); + BUG_ON(devfn 255); return VERSATILE_PCI_CFG_VIRT_BASE + ((busnr 16) | (PCI_SLOT(devfn) 11) | (PCI_FUNC(devfn) 8) | offset); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: integrator: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/mach-integrator/pci_v3.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index bbeca59..85938de 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c @@ -191,12 +191,9 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus, /* * Trap out illegal values */ - if (offset 255) - BUG(); - if (busnr 255) - BUG(); - if (devfn 255) - BUG(); + BUG_ON(offset 255); + BUG_ON(busnr 255); + BUG_ON(devfn 255); if (busnr == 0) { int slot = PCI_SLOT(devfn); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: dma: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/mach-rpc/dma.c |3 +-- arch/arm/mach-s3c64xx/dma.c |3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c index 85883b2..92e22ba 100644 --- a/arch/arm/mach-rpc/dma.c +++ b/arch/arm/mach-rpc/dma.c @@ -265,8 +265,7 @@ static void floppy_enable_dma(unsigned int chan, dma_t *dma) unsigned int fiqhandler_length; struct pt_regs regs; - if (fdma-dma.sg) - BUG(); + BUG_ON(fdma-dma.sg); if (fdma-dma.dma_mode == DMA_MODE_READ) { extern unsigned char floppy_fiqin_start, floppy_fiqin_end; diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c index f2a7a17..585c2ae 100644 --- a/arch/arm/mach-s3c64xx/dma.c +++ b/arch/arm/mach-s3c64xx/dma.c @@ -603,8 +603,7 @@ static irqreturn_t s3c64xx_dma_irq(int irq, void *pw) buff-next != chan-next) buff = buff-next; - if (!buff) - BUG(); + BUG_ON(!buff); if (buff == chan-next) buff = chan-end; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: OMAP1: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/mach-omap1/board-fsample.c |3 +-- arch/arm/mach-omap1/board-h2.c |3 +-- arch/arm/mach-omap1/board-h3.c |3 +-- arch/arm/mach-omap1/board-perseus2.c |3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c index 8b5800a..7ca6cc4 100644 --- a/arch/arm/mach-omap1/board-fsample.c +++ b/arch/arm/mach-omap1/board-fsample.c @@ -307,8 +307,7 @@ static void __init omap_fsample_init(void) fsample_init_smc91x(); - if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, NAND ready) 0) - BUG(); + BUG_ON(gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, NAND ready) 0); gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN); omap_cfg_reg(L3_1610_FLASH_CS2B_OE); diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 9134b64..4953cf7 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c @@ -412,8 +412,7 @@ static void __init h2_init(void) h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS; h2_nand_resource.end += SZ_4K - 1; - if (gpio_request(H2_NAND_RB_GPIO_PIN, NAND ready) 0) - BUG(); + BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, NAND ready) 0); gpio_direction_input(H2_NAND_RB_GPIO_PIN); omap_cfg_reg(L3_1610_FLASH_CS2B_OE); diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index bf213d1..563ba16 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c @@ -406,8 +406,7 @@ static void __init h3_init(void) nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS; nand_resource.end += SZ_4K - 1; - if (gpio_request(H3_NAND_RB_GPIO_PIN, NAND ready) 0) - BUG(); + BUG_ON(gpio_request(H3_NAND_RB_GPIO_PIN, NAND ready) 0); gpio_direction_input(H3_NAND_RB_GPIO_PIN); /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */ diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c index 030bd48..67c2612 100644 --- a/arch/arm/mach-omap1/board-perseus2.c +++ b/arch/arm/mach-omap1/board-perseus2.c @@ -275,8 +275,7 @@ static void __init omap_perseus2_init(void) perseus2_init_smc91x(); - if (gpio_request(P2_NAND_RB_GPIO_PIN, NAND ready) 0) - BUG(); + BUG_ON(gpio_request(P2_NAND_RB_GPIO_PIN, NAND ready) 0); gpio_direction_input(P2_NAND_RB_GPIO_PIN); omap_cfg_reg(L3_1610_FLASH_CS2B_OE); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] alpha: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/alpha/kernel/pci_iommu.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 3f844d2..a21d0ab 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c @@ -354,8 +354,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page, struct pci_dev *pdev = alpha_gendev_to_pci(dev); int dac_allowed; - if (dir == PCI_DMA_NONE) - BUG(); + BUG_ON(dir == PCI_DMA_NONE); dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev-dma_mask) : 0; return pci_map_single_1(pdev, (char *)page_address(page) + offset, @@ -378,8 +377,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr, struct pci_iommu_arena *arena; long dma_ofs, npages; - if (dir == PCI_DMA_NONE) - BUG(); + BUG_ON(dir == PCI_DMA_NONE); if (dma_addr = __direct_map_base dma_addr __direct_map_base + __direct_map_size) { @@ -662,8 +660,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg, dma_addr_t max_dma; int dac_allowed; - if (dir == PCI_DMA_NONE) - BUG(); + BUG_ON(dir == PCI_DMA_NONE); dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev-dma_mask) : 0; @@ -742,8 +739,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg, dma_addr_t max_dma; dma_addr_t fbeg, fend; - if (dir == PCI_DMA_NONE) - BUG(); + BUG_ON(dir == PCI_DMA_NONE); if (! alpha_mv.mv_pci_tbi) return; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: EXYNOS: use BUG_ON where possible
Just use BUG_ON() instead of constructions such as: if (...) BUG() A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e; @@ - if (e) BUG(); + BUG_ON(e); // /smpl Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/arm/mach-exynos/common.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 4e577f6..6a55a5a 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -465,10 +465,8 @@ static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int i else max_nr = EXYNOS4_MAX_COMBINER_NR; - if (combiner_nr = max_nr) - BUG(); - if (irq_set_handler_data(irq, combiner_data[combiner_nr]) != 0) - BUG(); + BUG_ON(combiner_nr = max_nr); + BUG_ON(irq_set_handler_data(irq, combiner_data[combiner_nr]) != 0); irq_set_chained_handler(irq, combiner_handle_cascade_irq); } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH]backlight: lm3639: fix coccinelle warning.
On Thu, 8 Nov 2012 15:44:49 +0900 G.Shark Jeong gshark.je...@gmail.com wrote: From: G.Shark Jeong gshark.je...@gmail.com Fix coccinelle warning. Please always quote the warning or error message text in the changelog when fixing an error or warning. diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c index 585949b..868a9da 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c @@ -403,9 +403,9 @@ static int __devexit lm3639_remove(struct i2c_client *client) regmap_write(pchip-regmap, REG_ENABLE, 0x00); - if (pchip-cdev_torch) + if ((pchip-cdev_torch)!=NULL) led_classdev_unregister(pchip-cdev_torch); - if (pchip-cdev_flash) + if ((pchip-cdev_flash)!=NULL) Please use scripts/checkpatch.pl. This code is just pointless. The expression anything will never evaluate to NULL. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched: add a tuning knob to allow changing RR tmeslice
Subject: [PATCH] sched: add a tuning knob to allow changing RR timeslice User wanted a facility simliar to the ability on Solaris to adjust the SCHED_RR timeslice value. Add a /proc/sys/kernel scheduler knob named sched_rr_timeslice_ms which allows global changing of the SCHED_RR timeslice value. User visable value is in milliseconds but is stored as jiffies. Setting to 0 (zero) resets to the default (currently 100ms). Patch against tip/master, currently 3.7-rc3. Signed-off-by: Clark Williams willi...@redhat.com --- include/linux/sched.h | 6 +- kernel/sched.c| 19 +++ kernel/sched_rt.c | 4 ++-- kernel/sysctl.c | 8 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 12317b6..214bf27 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2097,11 +2097,15 @@ static inline unsigned int get_sysctl_timer_migration(void) #endif extern unsigned int sysctl_sched_rt_period; extern int sysctl_sched_rt_runtime; - int sched_rt_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); +extern int sched_rr_timeslice; +extern int sched_rr_handler(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos); + #ifdef CONFIG_SCHED_AUTOGROUP extern unsigned int sysctl_sched_autogroup_enabled; diff --git a/kernel/sched.c b/kernel/sched.c index cdf9484..c63c3a4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -120,6 +120,7 @@ * Timeslices get refilled after they expire. */ #define DEF_TIMESLICE (100 * HZ / 1000) +int sched_rr_timeslice = DEF_TIMESLICE; /* * single value that denotes runtime == period, ie unlimited time. @@ -9614,6 +9615,24 @@ static int sched_rt_global_constraints(void) } #endif /* CONFIG_RT_GROUP_SCHED */ +int sched_rr_handler(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos) +{ + int ret; + static DEFINE_MUTEX(mutex); + + mutex_lock(mutex); + ret = proc_dointvec(table, write, buffer, lenp, ppos); + /* make sure that internally we keep jiffies */ + /* also, writing zero resets timeslice to default */ + if (!ret write) + sched_rr_timeslice = sched_rr_timeslice = 0 ? + DEF_TIMESLICE : msecs_to_jiffies(sched_rr_timeslice); + mutex_unlock(mutex); + return ret; +} + int sched_rt_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index c108b9c..799dd09 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c @@ -1791,7 +1791,7 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued) if (--p-rt.time_slice) return; - p-rt.time_slice = DEF_TIMESLICE; + p-rt.time_slice = sched_rr_timeslice; /* * Requeue to the end of queue if we are not the only element @@ -1819,7 +1819,7 @@ static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task) * Time slice is 0 for SCHED_FIFO tasks */ if (task-policy == SCHED_RR) - return DEF_TIMESLICE; + return sched_rr_timeslice; else return 0; } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ea7ec7f..10b1129 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -362,6 +362,14 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = sched_rt_handler, }, + { + .procname = sched_rr_timeslice_ms, + .data = sched_rr_timeslice, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = sched_rr_handler, + }, + #ifdef CONFIG_SCHED_AUTOGROUP { .procname = sched_autogroup_enabled, -- 1.7.11.7 signature.asc Description: PGP signature
Re: linux-next: manual merge of the arm-soc tree with the l2-mtd and pinctrl trees
Hi Arnd, On Thu, 8 Nov 2012 15:11:54 + Arnd Bergmann a...@arndb.de wrote: I think this one turned out wrong, and is missing this part: diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 5ccdf53..69769b7 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c @@ -26,7 +26,6 @@ #include linux/pinctrl/machine.h #include linux/platform_data/pinctrl-nomadik.h #include linux/platform_data/clocksource-nomadik-mtu.h -#include linux/platform_data/mtd-nomadik-nand.h #include asm/hardware/vic.h #include asm/sizes.h #include asm/mach-types.h The mtd-nomadik-nand.h inclusion was removed in the l2-mtd tree, but moved to a different line in the arm-soc tree. It needs to be removed because the header is gone now. Thanks for that. I have now fixed up my fix up :-) -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpnlfjJDR0Xj.pgp Description: PGP signature
[PATCH v3 0/4] ACPI: Refactor system notify handling
This patchset updates the ACPI system-level (ex. hotplug) notify handling with a new .sys_notify interface. It provides the following changes: - Allow ACPI drivers to register their system-level (hotplug) notify handlers to a new .sys_notify interface through their acpi_driver table. This removes redundant ACPI namespace walks from ACPI drivers for faster booting. The global notify handler acpi_bus_notify() is called for all system-level ACPI device notifications, which then calls an appropriate driver's handler if any. ACPI drivers no longer need to register or unregister driver's handlers to each device object in ACPI namespace. - Support dynamic ACPI namespace with LoadTable Unload opcode without any changes in ACPI drivers. There is no need to register / unregister handlers to ACPI device objects getting loaded to / unloaded from ACPI namespace. - Allow ACPI drivers to use a common hotplug handler when it is implemented. It removes functional conflict between driver's notify handler and the global notify handler acpi_bus_notify(). acpi_bus_notify() only calls an appropriate notify handler if any. Note that the changes maintain backward compatibility for ACPI drivers. Any drivers registered their hotplug handlers through the existing interfaces, such as acpi_install_notify_handler() and register_acpi_bus_notifier(), will continue to work as before. The patchset is based on the linux-next branch of linux-pm.git tree. v3: - Fixed to free the ID list when releasing a temporary device. v2: - Protected unbound driver from unloading when calling .sys_notify. - Changed acpi_bus_notify() to call acpi_bus_notify_list first for maintaining the original order. --- Toshi Kani (4): ACPI: Support system notify handler via .sys_notify ACPI: Update processor_driver to use .sys_notify ACPI: Update acpi_memhotplug to use .sys_notify ACPI: Update container to use .sys_notify --- drivers/acpi/acpi_memhotplug.c | 93 ++--- drivers/acpi/bus.c | 64 +--- drivers/acpi/container.c| 77 ++ drivers/acpi/processor_driver.c | 82 drivers/acpi/scan.c | 83 include/acpi/acpi_bus.h | 6 +++ 6 files changed, 150 insertions(+), 255 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/4] ACPI: Support system notify handler via .sys_notify
Added a new .sys_notify interface, which allows ACPI drivers to register their system-level (ex. hotplug) notify handlers through their acpi_driver table. This removes redundant ACPI namespace walks from ACPI drivers for faster booting. The global notify handler acpi_bus_notify() is called for all system-level ACPI notifications, which then calls an appropriate driver's handler if any. ACPI drivers no longer need to register or unregister driver's handler to each ACPI device object. It also supports dynamic ACPI namespace with LoadTable Unload opcode without any modification in ACPI drivers. Added a common system notify handler acpi_bus_sys_notify(), which allows ACPI drivers to set it to .sys_notify when this function is fully implemented. It removes functional conflict between driver's notify handler and the global notify handler acpi_bus_notify(). Note that the changes maintain backward compatibility for ACPI drivers. Any drivers registered their hotplug handler through the existing interfaces, such as acpi_install_notify_handler() and register_acpi_bus_notifier(), will continue to work as before. Signed-off-by: Toshi Kani toshi.k...@hp.com --- drivers/acpi/bus.c | 64 -- drivers/acpi/scan.c | 83 + include/acpi/acpi_bus.h | 6 3 files changed, 137 insertions(+), 16 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 07a20ee..b256bcf2 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -779,21 +779,16 @@ void unregister_acpi_bus_notifier(struct notifier_block *nb) EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier); /** - * acpi_bus_notify - * --- - * Callback for all 'system-level' device notifications (values 0x00-0x7F). + * acpi_bus_sys_notify: Common system notify handler + * + * ACPI drivers may specify this common handler to its sys_notify entry. + * TBD: This handler is not implemented yet. */ -static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) +void acpi_bus_sys_notify(acpi_handle handle, u32 type, void *data) { - struct acpi_device *device = NULL; - struct acpi_driver *driver; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, Notification %#02x to handle %p\n, type, handle)); - blocking_notifier_call_chain(acpi_bus_notify_list, - type, (void *)handle); - switch (type) { case ACPI_NOTIFY_BUS_CHECK: @@ -842,14 +837,51 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) type)); break; } +} + +/** + * acpi_bus_drv_notify: Call driver's system-level notify handler + */ +void acpi_bus_drv_notify(struct acpi_driver *driver, + struct acpi_device *device, acpi_handle handle, + u32 type, void *data) +{ + BUG_ON(!driver); + + if (driver-ops.sys_notify) + driver-ops.sys_notify(handle, type, data); + else if (device driver-ops.notify +(driver-flags ACPI_DRIVER_ALL_NOTIFY_EVENTS)) + driver-ops.notify(device, type); + + return; +} + +/** + * acpi_bus_notify: The system-level global notify handler + * + * The global notify handler for all 'system-level' device notifications + * (values 0x00-0x7F). This handler calls a driver's notify handler for + * the notified ACPI device. + */ +static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) +{ + struct acpi_device *device = NULL; + + /* call registered handlers in the bus notify list */ + blocking_notifier_call_chain(acpi_bus_notify_list, + type, (void *)handle); + /* obtain an associated driver if already bound */ acpi_bus_get_device(handle, device); - if (device) { - driver = device-driver; - if (driver driver-ops.notify - (driver-flags ACPI_DRIVER_ALL_NOTIFY_EVENTS)) - driver-ops.notify(device, type); - } + + /* call the driver's system-level notify handler */ + if (device device-driver) + acpi_bus_drv_notify(device-driver, device, handle, type, data); + else + acpi_lookup_drv_notify(handle, type, data); + + return; } /* -- diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 95ff1e8..333e57f 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1758,3 +1758,86 @@ int __init acpi_scan_init(void) return result; } + +/* callback args for acpi_match_drv_notify() */ +struct acpi_notify_args { + struct acpi_device *device; + acpi_handle handle; + u32 event; + void*data; +}; + +static int acpi_match_drv_notify(struct device_driver *drv, void
[PATCH v3 3/4] ACPI: Update acpi_memhotplug to use .sys_notify
Changed the ACPI memory hotplug driver to use .sys_notify. Removed ACPI namespace walks and their call-back functions that register and unregister the hotplug handler to all memory device objects through acpi_[install|remove]_notify_handler(). Signed-off-by: Toshi Kani toshi.k...@hp.com --- drivers/acpi/acpi_memhotplug.c | 93 ++ 1 file changed, 3 insertions(+), 90 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 92c973a..8af799f 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -54,6 +54,8 @@ MODULE_LICENSE(GPL); static int acpi_memory_device_add(struct acpi_device *device); static int acpi_memory_device_remove(struct acpi_device *device, int type); +static void acpi_memory_device_notify(acpi_handle handle, u32 event, + void *data); static const struct acpi_device_id memory_device_ids[] = { {ACPI_MEMORY_DEVICE_HID, 0}, @@ -68,6 +70,7 @@ static struct acpi_driver acpi_memory_device_driver = { .ops = { .add = acpi_memory_device_add, .remove = acpi_memory_device_remove, + .sys_notify = acpi_memory_device_notify, }, }; @@ -515,111 +518,21 @@ static int acpi_memory_device_remove(struct acpi_device *device, int type) return 0; } -/* - * Helper function to check for memory device - */ -static acpi_status is_memory_device(acpi_handle handle) -{ - char *hardware_id; - acpi_status status; - struct acpi_device_info *info; - - status = acpi_get_object_info(handle, info); - if (ACPI_FAILURE(status)) - return status; - - if (!(info-valid ACPI_VALID_HID)) { - kfree(info); - return AE_ERROR; - } - - hardware_id = info-hardware_id.string; - if ((hardware_id == NULL) || - (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) - status = AE_ERROR; - - kfree(info); - return status; -} - -static acpi_status -acpi_memory_register_notify_handler(acpi_handle handle, - u32 level, void *ctxt, void **retv) -{ - acpi_status status; - - - status = is_memory_device(handle); - if (ACPI_FAILURE(status)) - return AE_OK; /* continue */ - - status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, -acpi_memory_device_notify, NULL); - /* continue */ - return AE_OK; -} - -static acpi_status -acpi_memory_deregister_notify_handler(acpi_handle handle, - u32 level, void *ctxt, void **retv) -{ - acpi_status status; - - - status = is_memory_device(handle); - if (ACPI_FAILURE(status)) - return AE_OK; /* continue */ - - status = acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - acpi_memory_device_notify); - - return AE_OK; /* continue */ -} - static int __init acpi_memory_device_init(void) { int result; - acpi_status status; - result = acpi_bus_register_driver(acpi_memory_device_driver); if (result 0) return -ENODEV; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, -ACPI_UINT32_MAX, -acpi_memory_register_notify_handler, NULL, -NULL, NULL); - - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, walk_namespace failed)); - acpi_bus_unregister_driver(acpi_memory_device_driver); - return -ENODEV; - } - acpi_hotmem_initialized = 1; return 0; } static void __exit acpi_memory_device_exit(void) { - acpi_status status; - - - /* -* Adding this to un-install notification handlers for all the device -* handles. -*/ - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, -ACPI_UINT32_MAX, -acpi_memory_deregister_notify_handler, NULL, -NULL, NULL); - - if (ACPI_FAILURE(status)) - ACPI_EXCEPTION((AE_INFO, status, walk_namespace failed)); - acpi_bus_unregister_driver(acpi_memory_device_driver); return; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 2/4] ACPI: Update processor_driver to use .sys_notify
Changed the ACPI processor driver to use .sys_notify. Removed ACPI namespace walks and their call-back functions that register and unregister the hotplug handler to all processor objects through acpi_[install|remove]_notify_handler(). Signed-off-by: Toshi Kani toshi.k...@hp.com --- drivers/acpi/processor_driver.c | 82 - 1 file changed, 7 insertions(+), 75 deletions(-) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 8cc33d0..27f15f7 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -85,6 +85,10 @@ static void acpi_processor_notify(struct acpi_device *device, u32 event); static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr); static int acpi_processor_handle_eject(struct acpi_processor *pr); static int acpi_processor_start(struct acpi_processor *pr); +#ifdef CONFIG_ACPI_HOTPLUG_CPU +static void acpi_processor_hotplug_notify(acpi_handle handle, u32 event, + void *data); +#endif static const struct acpi_device_id processor_device_ids[] = { {ACPI_PROCESSOR_OBJECT_HID, 0}, @@ -104,6 +108,9 @@ static struct acpi_driver acpi_processor_driver = { .add = acpi_processor_add, .remove = acpi_processor_remove, .notify = acpi_processor_notify, +#ifdef CONFIG_ACPI_HOTPLUG_CPU + .sys_notify = acpi_processor_hotplug_notify, +#endif }, .drv.pm = acpi_processor_pm, }; @@ -763,67 +770,6 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, return; } -static acpi_status is_processor_device(acpi_handle handle) -{ - struct acpi_device_info *info; - char *hid; - acpi_status status; - - status = acpi_get_object_info(handle, info); - if (ACPI_FAILURE(status)) - return status; - - if (info-type == ACPI_TYPE_PROCESSOR) { - kfree(info); - return AE_OK; /* found a processor object */ - } - - if (!(info-valid ACPI_VALID_HID)) { - kfree(info); - return AE_ERROR; - } - - hid = info-hardware_id.string; - if ((hid == NULL) || strcmp(hid, ACPI_PROCESSOR_DEVICE_HID)) { - kfree(info); - return AE_ERROR; - } - - kfree(info); - return AE_OK; /* found a processor device object */ -} - -static acpi_status -processor_walk_namespace_cb(acpi_handle handle, - u32 lvl, void *context, void **rv) -{ - acpi_status status; - int *action = context; - - status = is_processor_device(handle); - if (ACPI_FAILURE(status)) - return AE_OK; /* not a processor; continue to walk */ - - switch (*action) { - case INSTALL_NOTIFY_HANDLER: - acpi_install_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - acpi_processor_hotplug_notify, - NULL); - break; - case UNINSTALL_NOTIFY_HANDLER: - acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - acpi_processor_hotplug_notify); - break; - default: - break; - } - - /* found a processor; skip walking underneath */ - return AE_CTRL_DEPTH; -} - static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr) { acpi_handle handle = pr-handle; @@ -891,26 +837,12 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr) static void acpi_processor_install_hotplug_notify(void) { -#ifdef CONFIG_ACPI_HOTPLUG_CPU - int action = INSTALL_NOTIFY_HANDLER; - acpi_walk_namespace(ACPI_TYPE_ANY, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - processor_walk_namespace_cb, NULL, action, NULL); -#endif register_hotcpu_notifier(acpi_cpu_notifier); } static void acpi_processor_uninstall_hotplug_notify(void) { -#ifdef CONFIG_ACPI_HOTPLUG_CPU - int action = UNINSTALL_NOTIFY_HANDLER; - acpi_walk_namespace(ACPI_TYPE_ANY, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - processor_walk_namespace_cb, NULL, action, NULL); -#endif unregister_hotcpu_notifier(acpi_cpu_notifier); } -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/4] ACPI: Update container to use .sys_notify
Changed the ACPI container driver to use .sys_notify. Removed ACPI namespace walks and their call-back functions that register and unregister the hotplug handler to all container objects through acpi_[install|remove]_notify_handler(). Renamed the notify handler to container_notify() for consistency. Signed-off-by: Toshi Kani toshi.k...@hp.com --- drivers/acpi/container.c | 77 ++-- 1 file changed, 3 insertions(+), 74 deletions(-) diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 69e2d6b..d4e8b71 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -53,6 +53,7 @@ MODULE_LICENSE(GPL); static int acpi_container_add(struct acpi_device *device); static int acpi_container_remove(struct acpi_device *device, int type); +static void container_notify(acpi_handle handle, u32 type, void *context); static const struct acpi_device_id container_device_ids[] = { {ACPI0004, 0}, @@ -69,6 +70,7 @@ static struct acpi_driver acpi_container_driver = { .ops = { .add = acpi_container_add, .remove = acpi_container_remove, + .sys_notify = container_notify, }, }; @@ -92,19 +94,6 @@ static int is_device_present(acpi_handle handle) return ((sta ACPI_STA_DEVICE_PRESENT) == ACPI_STA_DEVICE_PRESENT); } -static bool is_container_device(const char *hid) -{ - const struct acpi_device_id *container_id; - - for (container_id = container_device_ids; -container_id-id[0]; container_id++) { - if (!strcmp((char *)container_id-id, hid)) - return true; - } - - return false; -} - /***/ static int acpi_container_add(struct acpi_device *device) { @@ -165,7 +154,7 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle) return result; } -static void container_notify_cb(acpi_handle handle, u32 type, void *context) +static void container_notify(acpi_handle handle, u32 type, void *context) { struct acpi_device *device = NULL; int result; @@ -224,80 +213,20 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) return; } -static acpi_status -container_walk_namespace_cb(acpi_handle handle, - u32 lvl, void *context, void **rv) -{ - char *hid = NULL; - struct acpi_device_info *info; - acpi_status status; - int *action = context; - - status = acpi_get_object_info(handle, info); - if (ACPI_FAILURE(status)) { - return AE_OK; - } - - if (info-valid ACPI_VALID_HID) - hid = info-hardware_id.string; - - if (hid == NULL) { - goto end; - } - - if (!is_container_device(hid)) - goto end; - - switch (*action) { - case INSTALL_NOTIFY_HANDLER: - acpi_install_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - container_notify_cb, NULL); - break; - case UNINSTALL_NOTIFY_HANDLER: - acpi_remove_notify_handler(handle, - ACPI_SYSTEM_NOTIFY, - container_notify_cb); - break; - default: - break; - } - - end: - kfree(info); - - return AE_OK; -} - static int __init acpi_container_init(void) { int result = 0; - int action = INSTALL_NOTIFY_HANDLER; result = acpi_bus_register_driver(acpi_container_driver); if (result 0) { return (result); } - /* register notify handler to every container device */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - container_walk_namespace_cb, NULL, action, NULL); - return (0); } static void __exit acpi_container_exit(void) { - int action = UNINSTALL_NOTIFY_HANDLER; - - - acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - container_walk_namespace_cb, NULL, action, NULL); - acpi_bus_unregister_driver(acpi_container_driver); return; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: 82571EB: Detected Hardware Unit Hang
-Original Message- From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] On Behalf Of Joe Jin Sent: Wednesday, November 07, 2012 10:25 PM To: e1000-de...@lists.sf.net Cc: net...@vger.kernel.org; linux-kernel@vger.kernel.org; Mary Mcgrath Subject: 82571EB: Detected Hardware Unit Hang Hi list, IHAC reported 82571EB Detected Hardware Unit Hang on HP ProLiant DL360 G6, and have to reboot the server to recover: e1000e :06:00.1: eth3: Detected Hardware Unit Hang: TDH 1a TDT 1a next_to_use 1a next_to_clean18 buffer_info[next_to_clean]: time_stamp 10047a74e next_to_watch18 jiffies 10047a88c next_to_watch.status 1 MAC Status 80383 PHY Status 792d PHY 1000BASE-T Status 3800 PHY Extended Status3000 PCI Status 10 With newer kernel 2.0.0.1 the issue still reproducible. Device info: 06:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (Copper) (rev 06) 06:00.1 0200: 8086:10bc (rev 06) I compared lspci output before and after the issue, different as below: 06:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (Copper) (rev 06) Subsystem: Hewlett-Packard Company NC364T PCI Express Quad Port Gigabit Server Adapter Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR- FastB2B- DisINTx- - Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- INTx- + Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- +TAbort- MAbort- SERR- PERR- INTx+ Are you sure this is not similar issue as before that you reported. i.e. On Mon, 2012-07-09 at 16:51 +0800, Joe Jin wrote: I'm seeing a Unit Hang even with the latest e1000e driver 2.0.0 when doing scp test. this issue is easy do reproduced on SUN FIRE X2270 M2, just copy a big file (500M) from another server will hit it at once. All devices in path from root complex to 82571, should have *same* max payload size otherwise it can cause hang. Can you double check this? -Tushar -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v1 08/31] ARC: Fundamental ARCH data-types/defines
On 8 November 2012 19:52, Vineet Gupta vineet.gup...@synopsys.com wrote: On 7 November 2012 10:47, Vineet Gupta vineet.gup...@synopsys.com wrote: I'd recommend not exporting the pt_regs structure to userspace. This struct is used heavily within the kernel and it's nice to have the leeway to be able to modify it as things evolve. GDB doesn't need to know about this struct anymore as it should be using regset's for any recent architectures anyway, so it's the regset layout that should be ABI stable instead of pt_regs. You can check the openrisc architecture as an example of how to do this. Hi Jonas, thanks for your review comment. I completely agree that pt_regs should not be exported and very recently a change in pt_regs forced a gdbserver change too (ABI incompatibility) which goes along what you are recommending. Infact the ptrace patch for kernel (which will follow in series #2) provides a stable regset ABI - extracting information from pt_regs. However our current gdb/gdbserver is 6.8 based and making it switch to regset interface might not be possible for this release of tools. Since customers are already using our stuff, we can not have a broken ABI. We do have ABI versioning, so in next release we can fix gdb and remove this. For generic syscalls it was generally decided that the upstream kernel would drop support for legacy syscalls, _even though_ userspace bits like uClibc required them. For _new_ architectures, userspace would need to adapt to the _mainline_ kernel; and as a stop-gap for existing software, external patches could be carried in an external git repository where _non-mainline_ kernel patches could be carried to provide a working kernel until userspace could catch up. I'd say the same applies here: GDB 6.8 may continue work with a mainline kernel plus a patch that restores the export of pt_regs, but GDB 7.2 (or whatever version you move on to) would be the one that fully supports an unpatched mainline. Please note that an additional reason for exporting pt_regs is due to the fact that it is part of sigcontext. Keeping it exactly same as pt_regs helps us do batch save/restore of user context in signal handling (please look at my signal handling patch) but the flip side is that userspace SA_SIGINFO needs to be able to have access to sigcontext and hence we explicitly need pt_regs. We could arguably opencode pt_regs there - but that won't be clean IMHO. It's not really pt_regs you need here, but the userspace equivalent thereof. On OpenRISC, for example, we have user_regs_struct which is an ABI stable version of pt_regs. These may even be identical to begin with, but at least the distinction can be made now between the kernel-internal struct and the ABI stable one. /Jonas -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Kdump with signed images
On Thu, 2012-11-08 at 14:40 -0500, Vivek Goyal wrote: On Tue, Nov 06, 2012 at 03:51:59PM -0800, Eric W. Biederman wrote: [..] Thnking more about executable signature verification, I have another question. While verifyign the signature, we will have to read the whole executable in memory. That sounds bad as we are in kernel mode and will not be killed and if sombody is trying to execute a malformed exceptionally large executable, system will start killing other processess. We can potentially lock all the memory in kernel just by trying to execute a signed huge executable. Not good. I was looking at IMA and they seem to be using kernel_read() for reading page in and update digest. IIUC, that means page is read from disk, brought in cache and if needed will be read back from disk. But that means hacker can try to do some timing tricks and try to replace disk image after signature verification and run unsigned program. For the reason you mentioned, the signature verification is deferred to bprm, after the executable has been locked from modification. Any subsequent changes to the file would cause the file to be re-appraised. The goal of EVM/IMA-appraisal is to detect file tampering and enforce file data/metadata integrity. If EVM/IMA-appraisal fail, then as a last resort, we fall back and rely on IMA measurement/attestation at least to detect it. Mimi So how do we go about it. Neither of the approaches sound appealing to me. Thanks Vivek -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC] arm: memtest
Hello, I've recently discovered the lack of the command line parameter memtest for ARM. So I've made a patch. But I have some questions: 1. arch/x86/mm/memtest.c looks platform independ. The only thing why I don't use it for arm, is because it uses 64bit pointers. Maybe it could be moved to mm/memtest.c. If so, the memtest32.c I'm using (basically a copy of memtest.c) could be moved there too. 2. Because the below memtest32.c is basically a copy of arch/x86/mm/memtest.c, I'm not sure if the mapping from physical to virtual locations there does fit (always) for ARM too. I know almost as much about the in-kernel memory organization on x86 as on ARM, which is not really that much (some theory about TLBs, some source code explorations, ..., but I'm working on it). ;) 3. I've just implemented a test for all the memory which is marked as free, leaving all reserved memory untested. But even if a full memory test could only be done in the boot-loader, I think at least some of the memory the kernel reserves for itself (e.g. for modules) could be tested too. I just haven't searched how/where this could be done. Maybe someone else has a hint or even a patch for the below patch. 4. I don't have an ARM box with bad memory. So my tests are a bit limited. Maybe someone else could do a test with real bad memory. Anyway, I would still prefer to have at least the possibility to test some of the memory using the kernel instead of none at all. So if nobody offers a better solution, I would be glad if the below patch would find some friends. ;) Regards, Alexander Here is how dmesg does look like (memtest=4): - no error - [0.00] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [0.00] early_memtest: # of tests: 4 [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] early_memtest: wipe out test pattern from memory [0.00] 00 - 004000 pattern [0.00] early_memtest: # of tests: 4 [0.00] 54c000 - 0007ffb000 pattern [0.00] 54c000 - 0007ffb000 pattern [0.00] 54c000 - 0007ffb000 pattern [0.00] 54c000 - 0007ffb000 pattern [0.00] early_memtest: wipe out test pattern from memory [0.00] 54c000 - 0007ffb000 pattern [0.00] Memory: 128MB = 128MB total [0.00] Memory: 125648k/125648k available, 5424k reserved, 0K highmem - no error - - error inected (by sw) - [0.00] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [0.00] early_memtest: # of tests: 4 [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] early_memtest: wipe out test pattern from memory [0.00] 00 - 004000 pattern [0.00] early_memtest: # of tests: 4 [0.00] 54c000 - 0007ffb000 pattern [0.00] bad mem addr 60 - 600014 reserved [0.00] 600014 - 0007ffb000 pattern [0.00] 54c000 - 60 pattern [0.00] 600014 - 0007ffb000 pattern [0.00] 54c000 - 60 pattern [0.00] 600014 - 0007ffb000 pattern [0.00] 54c000 - 60 pattern [0.00] 600014 - 0007ffb000 pattern [0.00] early_memtest: wipe out test pattern from memory [0.00] 54c000 - 60 pattern [0.00] 600014 - 0007ffb000 pattern [0.00] Memory: 128MB = 128MB total [0.00] Memory: 125648k/125648k available, 5424k reserved, 0K highmem - error inected (by sw) - - with hole (mem=99M@0x0 mem=28M@0x640) - [0.00] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [0.00] early_memtest: # of tests: 4 [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] 00 - 004000 pattern [0.00] early_memtest: wipe out test pattern from memory [0.00] 00 - 004000 pattern [0.00] early_memtest: # of tests: 4 [0.00] 54c000 - 000630 pattern [0.00] 54c000 - 000630 pattern [0.00] 54c000 - 000630 pattern [0.00] 54c000 - 000630 pattern [0.00] early_memtest: wipe out test
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Thursday, November 08, 2012 10:20:42 PM Mika Westerberg wrote: On Thu, Nov 08, 2012 at 01:46:24AM +0100, Rafael J. Wysocki wrote: On Wednesday, November 07, 2012 03:05:48 PM Mika Westerberg wrote: On Wed, Nov 07, 2012 at 12:14:31PM +0100, Rafael J. Wysocki wrote: So is the idea now that the ACPI core parses the resources and passes them forward via struct acpi_device? I'm just wondering how to proceed with these I2C and SPI enumeration patches. Well, we definitely don't want to duplicate what drivers/pnp/pnpacpi/rsparser.c does, so the idea is to move the code from there to the core in such a way that both the SPI/I2C patches and the PNP layer can use it. Ok. I'll have some prototype code ready shortly, hopefully, and I'll post it in that form for comments (and so that you know what to expect). Sounds good. Thanks! There you go. I haven't even try to compile it, so most likely it breaks things left, right and in between, but I hope it shows the idea. Thanks Rafael! I'll try this tomorrow (we had problems with the HW today so I wasn't able to do any testing). I'll convert the SPI and I2C enumeration patches to use this method. OK, but I still need to move parsers of interrupt resources from rsparser.c to resource.c. :-) It does a couple of things at the same time, so it should be split into a few simpler patches. First, it moves some code from drivers/pnp/pnpacpi/rsparser.c to a new file drivers/acpi/resource.c and makes pnpacpi use functions from there. Second, it changes acpi_platform.c to use those functions too. Finally, it adds a list of ACPI resources to struct acpi_device and makes acpi_platform.c use that list intead of evaluating _CRS and parsing its output with acpi_walk_resources(). While changing acpi_platform.c I noticed that we had a bug in there, because GSIs were registered for the struct acpi_device object, although they should be registered for the struct platform_device one created by that code. I didn't try to fix that in the patch below, but it generally needs fixing. Good point. I wonder if the acpi_register_gsi() wants a device that is registered to the Linux device framework? No, it doesn't, as far as I can tell. At least the pnpacpi code adds devices after registering GSIs for them. Also the existing implementations of acpi_register_gsi() don't require that. At least with the SPI and I2C we generally don't have such until we call i2c_new_device() or spi_add_device() and they are getting passed the IRQ number which should be translated to the Linux IRQ before that... That's correct. It looks like we could follow the hpet code and pass NULL as the dev argument to acpi_register_gsi() from there, as apparently the dev argument is only used to special-case PCI devices in mp_config_acpi_gsi(). Thanks, Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH cifs-next] fs: cifs: make smb_echo_interval tunable
Change SMB_ECHO_INTERVAL to make it a module parameter. BugLink: http://bugs.launchpad.net/bugs/1017622 BugLink: https://bugzilla.samba.org/show_bug.cgi?id=9006 Reported-by: Oliver Dumschat-Hoette dumschat-hoe...@trisinus.de Signed-off-by: Chris J Arges chris.j.ar...@canonical.com --- fs/cifs/cifsfs.c |5 + fs/cifs/cifsglob.h |5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 5e62f44..25748b3 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -82,6 +82,11 @@ MODULE_PARM_DESC(cifs_max_pending, Simultaneous requests to server. module_param(enable_oplocks, bool, 0644); MODULE_PARM_DESC(enable_oplocks, Enable or disable oplocks. Default: y/Y/1); +unsigned short smb_echo_timeout = 60; +module_param(smb_echo_timeout, ushort, 0644); +MODULE_PARM_DESC(smb_echo_timeout, Timeout between two echo requests. + Default: 60. Timeout in seconds ); + extern mempool_t *cifs_sm_req_poolp; extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_mid_poolp; diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f5af252..d64dcd3 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -78,8 +78,9 @@ /* (max path length + 1 for null) * 2 for unicode*/ #define MAX_NAME 514 -/* SMB echo timeout -- FIXME: tunable? */ -#define SMB_ECHO_INTERVAL (60 * HZ) +/* SMB echo timeout */ +extern unsigned short smb_echo_timeout; +#define SMB_ECHO_INTERVAL (smb_echo_timeout * HZ) #include cifspdu.h -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] arch/arm: move secure_computing into trace
There is very little difference in the TIF_SECCOMP and TIF_SYSCALL_WORK path in entry-common.S, so merge TIF_SECCOMP into TIF_SYSCALL_WORK and move seccomp into the syscall_trace_enter() handler. Expanded some of the tracehook logic into the callers to make this code more readable. Since tracehook needs to do register changing, this portion is best left in its own function instead of copy/pasting into the callers. Additionally, the return value for secure_computing() is now checked and a -1 value will result in the system call being skipped. Signed-off-by: Kees Cook keesc...@chromium.org --- arch/arm/include/asm/thread_info.h |7 --- arch/arm/kernel/entry-common.S | 10 -- arch/arm/kernel/ptrace.c | 33 - 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 8477b4c..cddda1f 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -151,10 +151,10 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define TIF_SYSCALL_TRACE 8 #define TIF_SYSCALL_AUDIT 9 #define TIF_SYSCALL_TRACEPOINT 10 +#define TIF_SECCOMP11 /* seccomp syscall filtering active */ #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK20 -#define TIF_SECCOMP21 #define TIF_SWITCH_MM 22 /* deferred switch_mm */ #define _TIF_SIGPENDING(1 TIF_SIGPENDING) @@ -163,11 +163,12 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define _TIF_SYSCALL_TRACE (1 TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 TIF_SYSCALL_AUDIT) #define _TIF_SYSCALL_TRACEPOINT(1 TIF_SYSCALL_TRACEPOINT) -#define _TIF_USING_IWMMXT (1 TIF_USING_IWMMXT) #define _TIF_SECCOMP (1 TIF_SECCOMP) +#define _TIF_USING_IWMMXT (1 TIF_USING_IWMMXT) /* Checks for any syscall work in entry-common.S */ -#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) +#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP) /* * Change these and you break ASM code in entry-common.S diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 3471175..8355d4b 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -417,16 +417,6 @@ local_restart: ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing stmdb sp!, {r4, r5} @ push fifth and sixth args -#ifdef CONFIG_SECCOMP - tst r10, #_TIF_SECCOMP - beq 1f - mov r0, scno - bl __secure_computing - add r0, sp, #S_R0 + S_OFF @ pointer to regs - ldmia r0, {r0 - r3} @ have to reload r0 - r3 -1: -#endif - tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? bne __sys_trace diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 739db3a..2aecf8f 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -916,16 +916,11 @@ enum ptrace_syscall_dir { PTRACE_SYSCALL_EXIT, }; -static int ptrace_syscall_trace(struct pt_regs *regs, int scno, - enum ptrace_syscall_dir dir) +static int tracehook_report_syscall(struct pt_regs *regs, + enum ptrace_syscall_dir dir) { unsigned long ip; - current_thread_info()-syscall = scno; - - if (!test_thread_flag(TIF_SYSCALL_TRACE)) - return scno; - /* * IP is used to denote syscall entry/exit: * IP = 0 - entry, =1 - exit @@ -944,19 +939,39 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno, asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) { - scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); + current_thread_info()-syscall = scno; + + /* do the secure computing check first */ + if (secure_computing(scno) == -1) { + /* seccomp failures shouldn't expose any additional code. */ + scno = -1; + goto out; + } + + if (test_thread_flag(TIF_SYSCALL_TRACE)) + scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) trace_sys_enter(regs, scno); + audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs-ARM_r0, regs-ARM_r1, regs-ARM_r2, regs-ARM_r3); + +out: return scno; } asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno) { - scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT); + current_thread_info()-syscall =
[PATCH 4/4] arch/arm: select HAVE_ARCH_SECCOMP_FILTER
From: Will Drewry w...@chromium.org Reflect architectural support for seccomp filter. Signed-off-by: Will Drewry w...@chromium.org Signed-off-by: Kees Cook keesc...@chromium.org --- arch/arm/Kconfig |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ade7e92..0e8d490 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -21,6 +21,7 @@ config ARM select HAVE_AOUT select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL select HAVE_ARCH_KGDB + select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_BPF_JIT select HAVE_C_RECORDMCOUNT -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 0/4] arch/arm: support seccomp
This adds support for seccomp BPF to ARM. When built with the seccomp improvement patch waiting in linux-next (seccomp: Make syscall skipping and nr changes more consistent), this passes the seccomp regression test suite: https://github.com/redpig/seccomp Thanks, -Kees --- v4: - fixed syscall_get_arch, thanks to Will Deacon. v3: - updates suggested by Russell King: - reduced scope of expansion - leveraged TIF_SYSCALL_WORK bit mask - fixed syscall==-1 short-circuit logic v2: - expanded ptrace_syscall_trace() into both callers and do secure_computing() hookup there, as requested by Al Viro. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] arch/arm: add syscall_get_arch
From: Will Drewry w...@chromium.org Provide an ARM implementation of syscall_get_arch. This is a pre-requisite for CONFIG_HAVE_ARCH_SECCOMP_FILTER. Signed-off-by: Will Drewry w...@chromium.org Signed-off-by: Kees Cook keesc...@chromium.org --- arch/arm/include/asm/syscall.h |9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h index 9fdded6..f1d96d4 100644 --- a/arch/arm/include/asm/syscall.h +++ b/arch/arm/include/asm/syscall.h @@ -7,6 +7,8 @@ #ifndef _ASM_ARM_SYSCALL_H #define _ASM_ARM_SYSCALL_H +#include linux/audit.h /* for AUDIT_ARCH_* */ +#include linux/elf.h /* for ELF_EM */ #include linux/err.h #include linux/sched.h @@ -95,4 +97,11 @@ static inline void syscall_set_arguments(struct task_struct *task, memcpy(regs-ARM_r0 + i, args, n * sizeof(args[0])); } +static inline int syscall_get_arch(struct task_struct *task, + struct pt_regs *regs) +{ + /* ARM tasks don't change audit architectures on the fly. */ + return AUDIT_ARCH_ARM; +} + #endif /* _ASM_ARM_SYSCALL_H */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] arch/arm: allow a scno of -1 to not cause a SIGILL
On tracehook-friendly platforms, a system call number of -1 falls through without running much code or taking much action. ARM is different. This adds a short-circuit check in the trace path to avoid any additional work, as suggested by Russell King, to make sure that ARM behaves the same way as other platforms. Signed-off-by: Kees Cook keesc...@chromium.org --- arch/arm/kernel/entry-common.S |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 8355d4b..0bef977 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -448,7 +448,10 @@ __sys_trace: ldmccia r1, {r0 - r6} @ have to reload r0 - r6 stmccia sp, {r4, r5}@ and update the stack args ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine - b 2b + cmp scno, #-1 @ skip the syscall? + bne 2b + add sp, sp, #S_OFF @ restore stack + b ret_slow_syscall __sys_trace_return: str r0, [sp, #S_R0 + S_OFF]!@ save returned r0 -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support
On Thursday, November 08, 2012 06:05:23 PM Grant Likely wrote: On Wed, Nov 7, 2012 at 9:58 AM, Mika Westerberg mika.westerb...@linux.intel.com wrote: On Tue, Nov 06, 2012 at 11:36:08PM +0100, Rafael J. Wysocki wrote: OK, but then we need to pass the information obtained from _CRS (presumably after some adjustments through _SRS) to drivers, or rather to things like the SPI core, I2C core etc. so that they can create device objects for drivers to bind to and quite frankly I don't see why not to use ACPI resources for that. Nevertheless, the routines for parsing those resources should belong to the ACPI core, mostly to avoid code duplication. Rafael, So is the idea now that the ACPI core parses the resources and passes them forward via struct acpi_device? Not exactly. The idea is to execute _CRS in the core and attach the result as a list of resources the struct acpi_device object representing the given device node. I'm just wondering how to proceed with these I2C and SPI enumeration patches. From my experience with device tree, that seems the wrong way around. Device Tree used to have a separate of_device which is analogous to an acpi_device. No, it is not. If anything, struct acpi_device is a counterpart of struct device_node. :-) Yes, the name is misleading and it should be something like struct acpi_dev_node. Yes, these objects _are_ registered as devices with the driver model and there are drivers that bind to some of them. Yes, this is a mistake, but fixing it will take quite some time, because it involves converting the drivers in question. No, acpi_handle is not analogous to struct device_node, because it only is a pointer to a structure used internally by the AML interpreter. It only is useful for executing AML methods with the help of the interpreter, but there are reasons why _CRS, in particular, should only be executed by the ACPI core. The problem was always that of_devices never fit into the view that Linux has of the system. That would mean having both an of_device and and spi_device in completely separate parts of the driver model tree to support an spi device. Same for platform, i2c and onewire and others. Blech. So, yes I agree that ACPI core should have the tools for parsing the resources, but it makes sense for those functions to be helpers that the spi core acpi support and the i2c core acpi support use to populate the native spi_device and i2c_client structures. Yes, that exactly is the plan, although I2C and SPI will not receive the resources directly from _CRS. :-) Plus individual drivers can call the same functions if (and only if) the needed resources cannot fit into the bus type's native format. I'm kind of cautious about this particular thing. Thanks, Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/11] time: convert arch_gettimeoffset to a pointer
From: Stephen Warren swar...@nvidia.com Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each arch core provides a single implementation of arch_gettimeoffset(). In many cases, different sub-architectures, different machines, or different timer providers exist, and so the arch ends up implementing arch_gettimeoffset() as a call-through-pointer anyway. Examples are ARM, Cris, M68K, and it's arguable that the remaining architectures, M32R and Blackfin, should be doing this anyway. Modify arch_gettimeoffset so that it itself is a function pointer, which the arch initializes. This will allow later changes to move the initialization of this function into individual machine support or timer drivers. This is particularly useful for code in drivers/clocksource which should rely on an arch-independant mechanism to register their implementation of arch_gettimeoffset(). This patch also converts the Cris architecture to set arch_gettimeoffset directly to the final implementation in time_init(), because Cris already had separate time_init() functions per sub-architecture. M68K and ARM are converted to set arch_gettimeoffset the final implementation in later patches, because they already have function pointers in place for this purpose. Cc: Russell King li...@arm.linux.org.uk Cc: Mike Frysinger vap...@gentoo.org Cc: Mikael Starvik star...@axis.com Cc: Jesper Nilsson jesper.nils...@axis.com Cc: Hirokazu Takata tak...@linux-m32r.org Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: John Stultz johns...@us.ibm.com Cc: Thomas Gleixner t...@linutronix.de Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/kernel/time.c |6 +- arch/blackfin/kernel/time.c |6 +- arch/cris/arch-v10/kernel/time.c |6 -- arch/cris/kernel/time.c | 11 --- arch/m32r/kernel/time.c |4 +++- arch/m68k/kernel/time.c | 16 ++-- include/linux/time.h |4 +--- kernel/time/timekeeping.c| 20 +--- 8 files changed, 45 insertions(+), 28 deletions(-) diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 09be0c3..b0190b4 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -70,7 +70,7 @@ EXPORT_SYMBOL(profile_pc); #endif #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET -u32 arch_gettimeoffset(void) +static u32 arm_gettimeoffset(void) { if (system_timer-offset != NULL) return system_timer-offset() * 1000; @@ -164,6 +164,10 @@ device_initcall(timer_init_syscore_ops); void __init time_init(void) { +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET + arch_gettimeoffset = arm_gettimeoffset; +#endif + system_timer = machine_desc-timer; system_timer-init(); sched_clock_postinit(); diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c index 2310b24..3126b92 100644 --- a/arch/blackfin/kernel/time.c +++ b/arch/blackfin/kernel/time.c @@ -85,7 +85,7 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *)) /* * Should return useconds since last timer tick */ -u32 arch_gettimeoffset(void) +static u32 blackfin_gettimeoffset(void) { unsigned long offset; unsigned long clocks_per_jiffy; @@ -141,6 +141,10 @@ void read_persistent_clock(struct timespec *ts) void __init time_init(void) { +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET + arch_gettimeoffset = blackfin_gettimeoffset; +#endif + #ifdef CONFIG_RTC_DRV_BFIN /* [#2663] hack to filter junk RTC values that would cause * userspace to have to deal with time values greater than diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c index 162892f..fce7c54 100644 --- a/arch/cris/arch-v10/kernel/time.c +++ b/arch/cris/arch-v10/kernel/time.c @@ -55,9 +55,9 @@ unsigned long get_ns_in_jiffie(void) return ns; } -unsigned long do_slow_gettimeoffset(void) +static u32 cris_v10_gettimeoffset(void) { - unsigned long count; + u32 count; /* The timer interrupt comes from Etrax timer 0. In order to get * better precision, we check the current value. It might have @@ -191,6 +191,8 @@ static struct irqaction irq2 = { void __init time_init(void) { + arch_gettimeoffset = cris_v10_gettimeoffset; + /* probe for the RTC and read it if it exists * Before the RTC can be probed the loops_per_usec variable needs * to be initialized to make usleep work. A better value for diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index b063c92..fe6acda 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c @@ -39,17 +39,6 @@ extern unsigned long loops_per_jiffy; /* init/main.c */ unsigned long loops_per_usec; - -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET -extern unsigned long do_slow_gettimeoffset(void); -static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; - -u32 arch_gettimeoffset(void) -{ - return
[PATCH 03/11] m68k: set arch_gettimeoffset directly
From: Stephen Warren swar...@nvidia.com remove m68k's mach_gettimeoffset function pointer, and instead directly set the arch_gettimeoffset function pointer. This requires multiplying all function results by 1000, since the removed m68k_gettimeoffset() did this. Also, s/unsigned long/u32/ just to make the function prototypes exactly match that of arch_gettimeoffset. Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: Philip Blundell ph...@gnu.org Cc: Joshua Thompson fun...@jurai.org Cc: Sam Creasey sa...@sammy.net Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/m68k/amiga/config.c| 10 +- arch/m68k/apollo/config.c |9 - arch/m68k/atari/config.c|4 ++-- arch/m68k/atari/time.c |6 +++--- arch/m68k/bvme6000/config.c | 10 +- arch/m68k/hp300/config.c|2 +- arch/m68k/hp300/time.c |4 ++-- arch/m68k/hp300/time.h |2 +- arch/m68k/include/asm/machdep.h |2 +- arch/m68k/kernel/setup_mm.c |1 - arch/m68k/kernel/time.c |9 - arch/m68k/mac/config.c |4 ++-- arch/m68k/mac/via.c |4 ++-- arch/m68k/mvme147/config.c |8 arch/m68k/mvme16x/config.c |8 arch/m68k/q40/config.c |8 arch/m68k/sun3/config.c |4 ++-- arch/m68k/sun3/intersil.c |4 ++-- arch/m68k/sun3x/config.c|2 +- arch/m68k/sun3x/time.c |2 +- arch/m68k/sun3x/time.h |2 +- 21 files changed, 47 insertions(+), 58 deletions(-) diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c index ee01b7a..b819390 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c @@ -95,7 +95,7 @@ static void amiga_sched_init(irq_handler_t handler); static void amiga_get_model(char *model); static void amiga_get_hardware_list(struct seq_file *m); /* amiga specific timer functions */ -static unsigned long amiga_gettimeoffset(void); +static u32 amiga_gettimeoffset(void); extern void amiga_mksound(unsigned int count, unsigned int ticks); static void amiga_reset(void); extern void amiga_init_sound(void); @@ -377,7 +377,7 @@ void __init config_amiga(void) mach_init_IRQ= amiga_init_IRQ; mach_get_model = amiga_get_model; mach_get_hardware_list = amiga_get_hardware_list; - mach_gettimeoffset = amiga_gettimeoffset; + arch_gettimeoffset = amiga_gettimeoffset; /* * default MAX_DMA=0x on all machines. If we don't do so, the SCSI @@ -482,10 +482,10 @@ static void __init amiga_sched_init(irq_handler_t timer_routine) #define TICK_SIZE 1 /* This is always executed with interrupts disabled. */ -static unsigned long amiga_gettimeoffset(void) +static u32 amiga_gettimeoffset(void) { unsigned short hi, lo, hi2; - unsigned long ticks, offset = 0; + u32 ticks, offset = 0; /* read CIA B timer A current value */ hi = ciab.tahi; @@ -507,7 +507,7 @@ static unsigned long amiga_gettimeoffset(void) ticks = jiffy_ticks - ticks; ticks = (1 * ticks) / jiffy_ticks; - return ticks + offset; + return (ticks + offset) * 1000; } static void amiga_reset(void) __noreturn; diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c index f5565d6..3ea56b9 100644 --- a/arch/m68k/apollo/config.c +++ b/arch/m68k/apollo/config.c @@ -26,7 +26,7 @@ u_long apollo_model; extern void dn_sched_init(irq_handler_t handler); extern void dn_init_IRQ(void); -extern unsigned long dn_gettimeoffset(void); +extern u32 dn_gettimeoffset(void); extern int dn_dummy_hwclk(int, struct rtc_time *); extern int dn_dummy_set_clock_mmss(unsigned long); extern void dn_dummy_reset(void); @@ -151,7 +151,7 @@ void __init config_apollo(void) mach_sched_init=dn_sched_init; /* */ mach_init_IRQ=dn_init_IRQ; - mach_gettimeoffset = dn_gettimeoffset; + arch_gettimeoffset = dn_gettimeoffset; mach_max_dma_address = 0x; mach_hwclk = dn_dummy_hwclk; /* */ mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */ @@ -203,10 +203,9 @@ void dn_sched_init(irq_handler_t timer_routine) pr_err(Couldn't register timer interrupt\n); } -unsigned long dn_gettimeoffset(void) { - +u32 dn_gettimeoffset(void) +{ return 0xdeadbeef; - } int dn_dummy_hwclk(int op, struct rtc_time *t) { diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index d8eb327..037c11c 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -74,7 +74,7 @@ static void atari_heartbeat(int on); /* atari specific timer functions (in time.c) */ extern void atari_sched_init(irq_handler_t); -extern unsigned long atari_gettimeoffset (void); +extern u32 atari_gettimeoffset(void); extern int atari_mste_hwclk (int, struct rtc_time *); extern int atari_tt_hwclk (int, struct rtc_time *);
[PATCH 06/11] ARM: pxa: convert timer suspend/resume to clock_event_device
From: Stephen Warren swar...@nvidia.com Move PXA's timer suspend/resume functions from struct sys_timer pxa_timer into struct clock_event_device ckevt_pxa_osmr0. This will allow the sys_timer suspend/resume fields to be removed, and eventually lead to a complete removal of struct sys_timer. Cc: Eric Miao eric.y.m...@gmail.com Cc: Russell King li...@arm.linux.org.uk Cc: Haojian Zhuang haojian.zhu...@gmail.com Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/mach-pxa/time.c | 76 +++--- 1 files changed, 38 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index 4bc47d6..ce58bc9 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c @@ -89,12 +89,50 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) } } +#ifdef CONFIG_PM +static unsigned long osmr[4], oier, oscr; + +static void pxa_timer_suspend(struct clock_event_device *cedev) +{ + osmr[0] = readl_relaxed(OSMR0); + osmr[1] = readl_relaxed(OSMR1); + osmr[2] = readl_relaxed(OSMR2); + osmr[3] = readl_relaxed(OSMR3); + oier = readl_relaxed(OIER); + oscr = readl_relaxed(OSCR); +} + +static void pxa_timer_resume(struct clock_event_device *cedev) +{ + /* +* Ensure that we have at least MIN_OSCR_DELTA between match +* register 0 and the OSCR, to guarantee that we will receive +* the one-shot timer interrupt. We adjust OSMR0 in preference +* to OSCR to guarantee that OSCR is monotonically incrementing. +*/ + if (osmr[0] - oscr MIN_OSCR_DELTA) + osmr[0] += MIN_OSCR_DELTA; + + writel_relaxed(osmr[0], OSMR0); + writel_relaxed(osmr[1], OSMR1); + writel_relaxed(osmr[2], OSMR2); + writel_relaxed(osmr[3], OSMR3); + writel_relaxed(oier, OIER); + writel_relaxed(oscr, OSCR); +} +#else +#define pxa_timer_suspend NULL +#define pxa_timer_resume NULL +#endif + static struct clock_event_device ckevt_pxa_osmr0 = { .name = osmr0, .features = CLOCK_EVT_FEAT_ONESHOT, .rating = 200, .set_next_event = pxa_osmr0_set_next_event, .set_mode = pxa_osmr0_set_mode, + .suspend= pxa_timer_suspend, + .resume = pxa_timer_resume, }; static struct irqaction pxa_ost0_irq = { @@ -127,44 +165,6 @@ static void __init pxa_timer_init(void) clockevents_register_device(ckevt_pxa_osmr0); } -#ifdef CONFIG_PM -static unsigned long osmr[4], oier, oscr; - -static void pxa_timer_suspend(void) -{ - osmr[0] = readl_relaxed(OSMR0); - osmr[1] = readl_relaxed(OSMR1); - osmr[2] = readl_relaxed(OSMR2); - osmr[3] = readl_relaxed(OSMR3); - oier = readl_relaxed(OIER); - oscr = readl_relaxed(OSCR); -} - -static void pxa_timer_resume(void) -{ - /* -* Ensure that we have at least MIN_OSCR_DELTA between match -* register 0 and the OSCR, to guarantee that we will receive -* the one-shot timer interrupt. We adjust OSMR0 in preference -* to OSCR to guarantee that OSCR is monotonically incrementing. -*/ - if (osmr[0] - oscr MIN_OSCR_DELTA) - osmr[0] += MIN_OSCR_DELTA; - - writel_relaxed(osmr[0], OSMR0); - writel_relaxed(osmr[1], OSMR1); - writel_relaxed(osmr[2], OSMR2); - writel_relaxed(osmr[3], OSMR3); - writel_relaxed(oier, OIER); - writel_relaxed(oscr, OSCR); -} -#else -#define pxa_timer_suspend NULL -#define pxa_timer_resume NULL -#endif - struct sys_timer pxa_timer = { .init = pxa_timer_init, - .suspend= pxa_timer_suspend, - .resume = pxa_timer_resume, }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 08/11] ARM: ux500: convert timer suspend/resume to clock_event_device
From: Stephen Warren swar...@nvidia.com Move ux500's timer suspend/resume functions from struct sys_timer ux500_timer into struct clock_event_device nmdk_clkevt. This will allow the sys_timer suspend/resume fields to be removed, and eventually lead to a complete removal of struct sys_timer. Cc: Srinidhi Kasagar srinidhi.kasa...@stericsson.com Cc: Linus Walleij linus.wall...@linaro.org Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/mach-ux500/timer.c |7 --- drivers/clocksource/nomadik-mtu.c | 33 - 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index 875309a..46a7244 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c @@ -100,13 +100,6 @@ dt_fail: ux500_twd_init(); } -static void ux500_timer_reset(void) -{ - nmdk_clkevt_reset(); - nmdk_clksrc_reset(); -} - struct sys_timer ux500_timer = { .init = ux500_timer_init, - .resume = ux500_timer_reset, }; diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index 23c780b..a60b077 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c @@ -134,12 +134,32 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode, } } +void nmdk_clksrc_reset(void) +{ + /* Disable */ + writel(0, mtu_base + MTU_CR(0)); + + /* ClockSource: configure load and background-load, and fire it up */ + writel(nmdk_cycle, mtu_base + MTU_LR(0)); + writel(nmdk_cycle, mtu_base + MTU_BGLR(0)); + + writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA, + mtu_base + MTU_CR(0)); +} + +static void nmdk_clkevt_resume(struct clock_event_device *cedev) +{ + nmdk_clkevt_reset(); + nmdk_clksrc_reset(); +} + static struct clock_event_device nmdk_clkevt = { .name = mtu_1, .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, .rating = 200, .set_mode = nmdk_clkevt_mode, .set_next_event = nmdk_clkevt_next, + .resume = nmdk_clkevt_resume, }; /* @@ -161,19 +181,6 @@ static struct irqaction nmdk_timer_irq = { .dev_id = nmdk_clkevt, }; -void nmdk_clksrc_reset(void) -{ - /* Disable */ - writel(0, mtu_base + MTU_CR(0)); - - /* ClockSource: configure load and background-load, and fire it up */ - writel(nmdk_cycle, mtu_base + MTU_LR(0)); - writel(nmdk_cycle, mtu_base + MTU_BGLR(0)); - - writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA, - mtu_base + MTU_CR(0)); -} - void __init nmdk_timer_init(void __iomem *base, int irq) { unsigned long rate; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 11/11] ARM: delete struct sys_timer
From: Stephen Warren swar...@nvidia.com Now that the only field in struct sys_timer is .init, delete the struct, and replace the machine descriptor .timer field with the initialization function itself. This will enable moving timer drivers into drivers/clocksource without having to place a public prototype of each struct sys_timer object into include/linux; the intent is to create a single of_clocksource_init() function that determines which timer driver to initialize by scanning the device dtree, much like the proposed irqchip_init() at: http://www.spinics.net/lists/arm-kernel/msg203686.html RFC: This will be quite a large patch since it'll end up touching tens or hundreds of ARM board files, timer drivers, etc. Perhaps it'd be better to create patches that: 1) Add .init_time field to machine descriptor, update ARM's time_init to use that if present, else fall back to .timer.init. 2) 1 patch per ARM sub-architecture to convert to from .timer to .init_time. 3) Remove sys_timer and machine descriptor .timer field. For now, this patch only converts Tegra as an example of my intent. Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/include/asm/mach/arch.h |3 +-- arch/arm/include/asm/mach/time.h | 16 arch/arm/kernel/time.c |9 + arch/arm/mach-tegra/board-dt-tegra20.c |2 +- arch/arm/mach-tegra/board-dt-tegra30.c |2 +- arch/arm/mach-tegra/board.h|2 +- arch/arm/mach-tegra/timer.c|6 +- 7 files changed, 6 insertions(+), 34 deletions(-) diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 917d4fc..308ad7d 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -12,7 +12,6 @@ struct tag; struct meminfo; -struct sys_timer; struct pt_regs; struct smp_operations; #ifdef CONFIG_SMP @@ -48,7 +47,7 @@ struct machine_desc { void(*map_io)(void);/* IO mapping function */ void(*init_early)(void); void(*init_irq)(void); - struct sys_timer*timer; /* system tick timer*/ + void(*init_time)(void); void(*init_machine)(void); void(*init_late)(void); #ifdef CONFIG_MULTI_IRQ_HANDLER diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index d316d76..90c12e1 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -10,22 +10,6 @@ #ifndef __ASM_ARM_MACH_TIME_H #define __ASM_ARM_MACH_TIME_H -/* - * This is our kernel timer structure. - * - * - init - * Initialise the kernels jiffy timer source, claim interrupt - * using setup_irq. This is called early on during initialisation - * while interrupts are still disabled on the local CPU. - * - offset - * Return the timer offset in microseconds since the last timer - * interrupt. Note: this must take account of any unprocessed - * timer interrupt which may be pending. - */ -struct sys_timer { - void(*init)(void); -}; - extern void timer_tick(void); struct timespec; diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 0b51a7c..955d92d 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -30,11 +30,6 @@ #include asm/mach/arch.h #include asm/mach/time.h -/* - * Our system timer. - */ -static struct sys_timer *system_timer; - #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) /* this needs a better home */ @@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot, void __init time_init(void) { - system_timer = machine_desc-timer; - system_timer-init(); + machine_desc-init_time(); sched_clock_postinit(); } - diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c index 22f5a9b..3777b03 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/board-dt-tegra20.c @@ -192,7 +192,7 @@ DT_MACHINE_START(TEGRA_DT, nVidia Tegra20 (Flattened Device Tree)) .init_early = tegra20_init_early, .init_irq = tegra_dt_init_irq, .handle_irq = gic_handle_irq, - .timer = tegra_sys_timer, + .init_time = tegra_init_timer, .init_machine = tegra_dt_init, .init_late = tegra_dt_init_late, .restart= tegra_assert_system_reset, diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c index cd30338..08d3b19 100644 --- a/arch/arm/mach-tegra/board-dt-tegra30.c +++ b/arch/arm/mach-tegra/board-dt-tegra30.c @@ -104,7 +104,7 @@ DT_MACHINE_START(TEGRA30_DT, NVIDIA Tegra30 (Flattened Device Tree)) .init_early = tegra30_init_early, .init_irq
[PATCH 10/11] ARM: remove struct sys_timer suspend and resume fields
From: Stephen Warren swar...@nvidia.com These fields duplicate e.g. struct clock_event_device's suspend and resume fields, so remove them now that nothing is using them. The aim is to remove all fields from struct sys_timer except .init, then replace the ARM machine descriptor's .timer field with a .init_time function instead, and delete struct sys_timer. Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/include/asm/mach/time.h | 11 --- arch/arm/kernel/time.c | 34 -- 2 files changed, 0 insertions(+), 45 deletions(-) diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index cac8d9c..d316d76 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -17,15 +17,6 @@ * Initialise the kernels jiffy timer source, claim interrupt * using setup_irq. This is called early on during initialisation * while interrupts are still disabled on the local CPU. - * - suspend - * Suspend the kernel jiffy timer source, if necessary. This - * is called with interrupts disabled, after all normal devices - * have been suspended. If no action is required, set this to - * NULL. - * - resume - * Resume the kernel jiffy timer source, if necessary. This - * is called with interrupts disabled before any normal devices - * are resumed. If no action is required, set this to NULL. * - offset * Return the timer offset in microseconds since the last timer * interrupt. Note: this must take account of any unprocessed @@ -33,8 +24,6 @@ */ struct sys_timer { void(*init)(void); - void(*suspend)(void); - void(*resume)(void); }; extern void timer_tick(void); diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index ea36bfa..0b51a7c 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -21,7 +21,6 @@ #include linux/timex.h #include linux/errno.h #include linux/profile.h -#include linux/syscore_ops.h #include linux/timer.h #include linux/irq.h @@ -119,39 +118,6 @@ int __init register_persistent_clock(clock_access_fn read_boot, return -EINVAL; } -#if defined(CONFIG_PM) !defined(CONFIG_GENERIC_CLOCKEVENTS) -static int timer_suspend(void) -{ - if (system_timer-suspend) - system_timer-suspend(); - - return 0; -} - -static void timer_resume(void) -{ - if (system_timer-resume) - system_timer-resume(); -} -#else -#define timer_suspend NULL -#define timer_resume NULL -#endif - -static struct syscore_ops timer_syscore_ops = { - .suspend= timer_suspend, - .resume = timer_resume, -}; - -static int __init timer_init_syscore_ops(void) -{ - register_syscore_ops(timer_syscore_ops); - - return 0; -} - -device_initcall(timer_init_syscore_ops); - void __init time_init(void) { system_timer = machine_desc-timer; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: delete struct sys_timer
From: Stephen Warren swar...@nvidia.com Now that the only field in struct sys_timer is .init, delete the struct, and replace the machine descriptor .timer field with the initialization function itself. This will enable moving timer drivers into drivers/clocksource without having to place a public prototype of each struct sys_timer object into include/linux; the intent is to create a single of_clocksource_init() function that determines which timer driver to initialize by scanning the device dtree, much like the proposed irqchip_init() at: http://www.spinics.net/lists/arm-kernel/msg203686.html RFC: This will be quite a large patch since it'll end up touching tens or hundreds of ARM board files, timer drivers, etc. Perhaps it'd be better to create patches that: 1) Add .init_time field to machine descriptor, update ARM's time_init to use that if present, else fall back to .timer.init. 2) 1 patch per ARM sub-architecture to convert to from .timer to .init_time. 3) Remove sys_timer and machine descriptor .timer field. For now, this patch only converts Tegra as an example of my intent. Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/include/asm/mach/arch.h |3 +-- arch/arm/include/asm/mach/time.h | 16 arch/arm/kernel/time.c |9 + arch/arm/mach-tegra/board-dt-tegra20.c |2 +- arch/arm/mach-tegra/board-dt-tegra30.c |2 +- arch/arm/mach-tegra/board.h|2 +- arch/arm/mach-tegra/timer.c|6 +- 7 files changed, 6 insertions(+), 34 deletions(-) diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 917d4fc..308ad7d 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -12,7 +12,6 @@ struct tag; struct meminfo; -struct sys_timer; struct pt_regs; struct smp_operations; #ifdef CONFIG_SMP @@ -48,7 +47,7 @@ struct machine_desc { void(*map_io)(void);/* IO mapping function */ void(*init_early)(void); void(*init_irq)(void); - struct sys_timer*timer; /* system tick timer*/ + void(*init_time)(void); void(*init_machine)(void); void(*init_late)(void); #ifdef CONFIG_MULTI_IRQ_HANDLER diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index d316d76..90c12e1 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -10,22 +10,6 @@ #ifndef __ASM_ARM_MACH_TIME_H #define __ASM_ARM_MACH_TIME_H -/* - * This is our kernel timer structure. - * - * - init - * Initialise the kernels jiffy timer source, claim interrupt - * using setup_irq. This is called early on during initialisation - * while interrupts are still disabled on the local CPU. - * - offset - * Return the timer offset in microseconds since the last timer - * interrupt. Note: this must take account of any unprocessed - * timer interrupt which may be pending. - */ -struct sys_timer { - void(*init)(void); -}; - extern void timer_tick(void); struct timespec; diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 0b51a7c..955d92d 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -30,11 +30,6 @@ #include asm/mach/arch.h #include asm/mach/time.h -/* - * Our system timer. - */ -static struct sys_timer *system_timer; - #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \ defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) /* this needs a better home */ @@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot, void __init time_init(void) { - system_timer = machine_desc-timer; - system_timer-init(); + machine_desc-init_time(); sched_clock_postinit(); } - diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c index 22f5a9b..3777b03 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/board-dt-tegra20.c @@ -192,7 +192,7 @@ DT_MACHINE_START(TEGRA_DT, nVidia Tegra20 (Flattened Device Tree)) .init_early = tegra20_init_early, .init_irq = tegra_dt_init_irq, .handle_irq = gic_handle_irq, - .timer = tegra_sys_timer, + .init_time = tegra_init_timer, .init_machine = tegra_dt_init, .init_late = tegra_dt_init_late, .restart= tegra_assert_system_reset, diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c index cd30338..08d3b19 100644 --- a/arch/arm/mach-tegra/board-dt-tegra30.c +++ b/arch/arm/mach-tegra/board-dt-tegra30.c @@ -104,7 +104,7 @@ DT_MACHINE_START(TEGRA30_DT, NVIDIA Tegra30 (Flattened Device Tree)) .init_early = tegra30_init_early, .init_irq
[RFC PATCH 00/11] arch_gettimeoffset and ARM timer rework
From: Stephen Warren swar...@nvidia.com The overall aim of this series is to allow ARM (or indeed any) timer drivers to be moved into drivers/clocksource without requiring a struct or function prototype for each individual driver in include/linux. The intent is eventually to create a single e.g. of_clocksource_init() function that determines which timer driver to initialize by scanning the device dtree, much like the proposed irqchip_init() at: http://www.spinics.net/lists/arm-kernel/msg203686.html This requires some rework prior to implementing of_clocksource_init(): ARM uses struct sys_timer to represent the individual machine's timer driver. Many of the patches in this series are ARM-specific changes to get rid of this struct, leaving just a single init function instead. One function pointer in the struct provides the implementation of arch_gettimeoffset(). Removing the struct and moving drivers into the generic drivers/clocksource directory requires an arch-agnostic way of registering the implementation of this function. The first few patches in the series provide that, and rework various architectures to make use of this facility rather than implementing the same thing themselves. It would probably be easiest to merge this whole series through the arm-soc tree. Anything else would require some co-ordination. Stephen Warren (11): cris: move usec/nsec conversion to do_slow_gettimeoffset time: convert arch_gettimeoffset to a pointer m68k: set arch_gettimeoffset directly ARM: set arch_gettimeoffset directly ARM: at91: convert timer suspend/resume to clock_event_device ARM: pxa: convert timer suspend/resume to clock_event_device ARM: sa1100: convert timer suspend/resume to clock_event_device ARM: ux500: convert timer suspend/resume to clock_event_device ARM: samsung: register syscore_ops for timer resume directly ARM: remove struct sys_timer suspend and resume fields ARM: delete struct sys_timer arch/arm/include/asm/mach/arch.h |3 +- arch/arm/include/asm/mach/time.h | 30 arch/arm/kernel/time.c | 53 +-- arch/arm/mach-at91/at91sam926x_time.c | 47 +++- arch/arm/mach-at91/at91x40_time.c |8 ++- arch/arm/mach-ebsa110/core.c |7 ++- arch/arm/mach-ep93xx/core.c| 23 +- arch/arm/mach-h720x/common.c |6 +- arch/arm/mach-h720x/common.h |2 +- arch/arm/mach-h720x/cpu-h7201.c|3 +- arch/arm/mach-h720x/cpu-h7202.c|3 +- arch/arm/mach-pxa/time.c | 76 arch/arm/mach-rpc/time.c |6 +- arch/arm/mach-sa1100/time.c| 66 ++-- arch/arm/mach-tegra/board-dt-tegra20.c |2 +- arch/arm/mach-tegra/board-dt-tegra30.c |2 +- arch/arm/mach-tegra/board.h|2 +- arch/arm/mach-tegra/timer.c|6 +-- arch/arm/mach-ux500/timer.c|7 --- arch/arm/plat-samsung/time.c | 14 -- arch/blackfin/kernel/time.c|6 ++- arch/cris/arch-v10/kernel/time.c | 10 +++-- arch/cris/kernel/time.c| 11 - arch/m32r/kernel/time.c|4 +- arch/m68k/amiga/config.c | 10 ++-- arch/m68k/apollo/config.c |9 ++-- arch/m68k/atari/config.c |4 +- arch/m68k/atari/time.c |6 +- arch/m68k/bvme6000/config.c| 10 ++-- arch/m68k/hp300/config.c |2 +- arch/m68k/hp300/time.c |4 +- arch/m68k/hp300/time.h |2 +- arch/m68k/include/asm/machdep.h|2 +- arch/m68k/kernel/setup_mm.c|1 - arch/m68k/kernel/time.c| 15 ++ arch/m68k/mac/config.c |4 +- arch/m68k/mac/via.c|4 +- arch/m68k/mvme147/config.c |8 ++-- arch/m68k/mvme16x/config.c |8 ++-- arch/m68k/q40/config.c |8 ++-- arch/m68k/sun3/config.c|4 +- arch/m68k/sun3/intersil.c |4 +- arch/m68k/sun3x/config.c |2 +- arch/m68k/sun3x/time.c |2 +- arch/m68k/sun3x/time.h |2 +- drivers/clocksource/nomadik-mtu.c | 33 - include/linux/time.h |4 +- kernel/time/timekeeping.c | 20 +++- 48 files changed, 249 insertions(+), 316 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/11] ARM: samsung: register syscore_ops for timer resume directly
From: Stephen Warren swar...@nvidia.com Instead of using struct sys_timer's resume function, register syscore_ops directly in s3c2410_timer_init(). This will allow the sys_timer suspend/ resume fields to be removed, and eventually lead to a complete removal of struct sys_timer. Cc: Ben Dooks ben-li...@fluff.org Cc: Kukjin Kim kgene@samsung.com Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/plat-samsung/time.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c index 67206df..773745a 100644 --- a/arch/arm/plat-samsung/time.c +++ b/arch/arm/plat-samsung/time.c @@ -27,6 +27,7 @@ #include linux/clk.h #include linux/io.h #include linux/platform_device.h +#include linux/syscore_ops.h #include asm/mach-types.h @@ -271,6 +272,10 @@ static void __init s3c2410_timer_resources(void) clk_enable(tin); } +static struct syscore_ops s3c24xx_syscore_ops = { + .resume = s3c2410_timer_setup, +}; + static void __init s3c2410_timer_init(void) { arch_gettimeoffset = s3c2410_gettimeoffset; @@ -278,9 +283,9 @@ static void __init s3c2410_timer_init(void) s3c2410_timer_resources(); s3c2410_timer_setup(); setup_irq(IRQ_TIMER4, s3c2410_timer_irq); + register_syscore_ops(s3c24xx_syscore_ops); } struct sys_timer s3c24xx_timer = { .init = s3c2410_timer_init, - .resume = s3c2410_timer_setup }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Kdump with signed images
Vivek Goyal vgo...@redhat.com writes: On Thu, Nov 08, 2012 at 02:40:50PM -0500, Vivek Goyal wrote: On Tue, Nov 06, 2012 at 03:51:59PM -0800, Eric W. Biederman wrote: [..] Thnking more about executable signature verification, I have another question. While verifyign the signature, we will have to read the whole executable in memory. That sounds bad as we are in kernel mode and will not be killed and if sombody is trying to execute a malformed exceptionally large executable, system will start killing other processess. We can potentially lock all the memory in kernel just by trying to execute a signed huge executable. Not good. Also, even if we try to read in whole executable, can't an hacker modify pages in swap disk and then they will be faulted back in and bingo hacker is running its unsigned code. (assuming root has been compromised otherwise why do we have to do all this exercise). You make a decent case for an implicit mlockall(MCL_FUTURE) being required of signed executables, that are going to be granted privileges based on signature verification. As for size if the executable won't fit in memory, there is no point in checking the signature. It should be fairly straight forward to make the signature checking process preemptable and killable. Of course this is all hand waving at this point. Eric -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 07/11] ARM: sa1100: convert timer suspend/resume to clock_event_device
From: Stephen Warren swar...@nvidia.com Move sa1100's timer suspend/resume functions from struct sys_timer sa1100_timer into struct clock_event_device ckevt_sa1100_osmr0. This will allow the sys_timer suspend/resume fields to be removed, and eventually lead to a complete removal of struct sys_timer. Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/mach-sa1100/time.c | 66 +- 1 files changed, 33 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c index 80702c9..164f827 100644 --- a/arch/arm/mach-sa1100/time.c +++ b/arch/arm/mach-sa1100/time.c @@ -69,12 +69,45 @@ sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) } } +#ifdef CONFIG_PM +unsigned long osmr[4], oier; + +static void sa1100_timer_suspend(struct clock_event_device *cedev) +{ + osmr[0] = readl_relaxed(OSMR0); + osmr[1] = readl_relaxed(OSMR1); + osmr[2] = readl_relaxed(OSMR2); + osmr[3] = readl_relaxed(OSMR3); + oier = readl_relaxed(OIER); +} + +static void sa1100_timer_resume(struct clock_event_device *cedev) +{ + writel_relaxed(0x0f, OSSR); + writel_relaxed(osmr[0], OSMR0); + writel_relaxed(osmr[1], OSMR1); + writel_relaxed(osmr[2], OSMR2); + writel_relaxed(osmr[3], OSMR3); + writel_relaxed(oier, OIER); + + /* +* OSMR0 is the system timer: make sure OSCR is sufficiently behind +*/ + writel_relaxed(OSMR0 - LATCH, OSCR); +} +#else +#define sa1100_timer_suspend NULL +#define sa1100_timer_resume NULL +#endif + static struct clock_event_device ckevt_sa1100_osmr0 = { .name = osmr0, .features = CLOCK_EVT_FEAT_ONESHOT, .rating = 200, .set_next_event = sa1100_osmr0_set_next_event, .set_mode = sa1100_osmr0_set_mode, + .suspend= sa1100_timer_suspend, + .resume = sa1100_timer_resume, }; static struct irqaction sa1100_timer_irq = { @@ -105,39 +138,6 @@ static void __init sa1100_timer_init(void) clockevents_register_device(ckevt_sa1100_osmr0); } -#ifdef CONFIG_PM -unsigned long osmr[4], oier; - -static void sa1100_timer_suspend(void) -{ - osmr[0] = readl_relaxed(OSMR0); - osmr[1] = readl_relaxed(OSMR1); - osmr[2] = readl_relaxed(OSMR2); - osmr[3] = readl_relaxed(OSMR3); - oier = readl_relaxed(OIER); -} - -static void sa1100_timer_resume(void) -{ - writel_relaxed(0x0f, OSSR); - writel_relaxed(osmr[0], OSMR0); - writel_relaxed(osmr[1], OSMR1); - writel_relaxed(osmr[2], OSMR2); - writel_relaxed(osmr[3], OSMR3); - writel_relaxed(oier, OIER); - - /* -* OSMR0 is the system timer: make sure OSCR is sufficiently behind -*/ - writel_relaxed(OSMR0 - LATCH, OSCR); -} -#else -#define sa1100_timer_suspend NULL -#define sa1100_timer_resume NULL -#endif - struct sys_timer sa1100_timer = { .init = sa1100_timer_init, - .suspend= sa1100_timer_suspend, - .resume = sa1100_timer_resume, }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/11] ARM: at91: convert timer suspend/resume to clock_event_device
From: Stephen Warren swar...@nvidia.com Move at91's timer suspend/resume functions from struct sys_timer at91sam926x_timer into struct clock_event_device pit_clkevt. This will allow the sys_timer suspend/resume fields to be removed, and eventually lead to a complete removal of struct sys_timer. Cc: Andrew Victor li...@maxim.org.za Cc: Nicolas Ferre nicolas.fe...@atmel.com Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/mach-at91/at91sam926x_time.c | 47 ++-- 1 files changed, 26 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c index ffc0957..2794882 100644 --- a/arch/arm/mach-at91/at91sam926x_time.c +++ b/arch/arm/mach-at91/at91sam926x_time.c @@ -94,12 +94,38 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) } } +static void at91sam926x_pit_suspend(struct clock_event_device *cedev) +{ + /* Disable timer */ + pit_write(AT91_PIT_MR, 0); +} + +static void at91sam926x_pit_reset(void) +{ + /* Disable timer and irqs */ + pit_write(AT91_PIT_MR, 0); + + /* Clear any pending interrupts, wait for PIT to stop counting */ + while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0) + cpu_relax(); + + /* Start PIT but don't enable IRQ */ + pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); +} + +static void at91sam926x_pit_resume(struct clock_event_device *cedev) +{ + at91sam926x_pit_reset(); +} + static struct clock_event_device pit_clkevt = { .name = pit, .features = CLOCK_EVT_FEAT_PERIODIC, .shift = 32, .rating = 100, .set_mode = pit_clkevt_mode, + .suspend= at91sam926x_pit_suspend, + .resume = at91sam926x_pit_resume, }; @@ -140,19 +166,6 @@ static struct irqaction at91sam926x_pit_irq = { .irq= NR_IRQS_LEGACY + AT91_ID_SYS, }; -static void at91sam926x_pit_reset(void) -{ - /* Disable timer and irqs */ - pit_write(AT91_PIT_MR, 0); - - /* Clear any pending interrupts, wait for PIT to stop counting */ - while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0) - cpu_relax(); - - /* Start PIT but don't enable IRQ */ - pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); -} - #ifdef CONFIG_OF static struct of_device_id pit_timer_ids[] = { { .compatible = atmel,at91sam9260-pit }, @@ -240,12 +253,6 @@ static void __init at91sam926x_pit_init(void) clockevents_register_device(pit_clkevt); } -static void at91sam926x_pit_suspend(void) -{ - /* Disable timer */ - pit_write(AT91_PIT_MR, 0); -} - void __init at91sam926x_ioremap_pit(u32 addr) { #if defined(CONFIG_OF) @@ -265,6 +272,4 @@ void __init at91sam926x_ioremap_pit(u32 addr) struct sys_timer at91sam926x_timer = { .init = at91sam926x_pit_init, - .suspend= at91sam926x_pit_suspend, - .resume = at91sam926x_pit_reset, }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: delete struct sys_timer
On 11/08/2012 02:01 PM, Stephen Warren wrote: Now that the only field in struct sys_timer is .init, delete the struct, and replace the machine descriptor .timer field with the initialization function itself. Oops. This one patch is a duplicate of 11/11 in the series I just sent. Sorry. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/11] ARM: set arch_gettimeoffset directly
From: Stephen Warren swar...@nvidia.com remove ARM's struct sys_timer .offset function pointer, and instead directly set the arch_gettimeoffset function pointer when the timer driver is initialized. This requires multiplying all function results by 1000, since the removed arm_gettimeoffset() did this. Also, s/unsigned long/u32/ just to make the function prototypes exactly match that of arch_gettimeoffset. Cc: Russell King li...@arm.linux.org.uk Cc: Andrew Victor li...@maxim.org.za Cc: Nicolas Ferre nicolas.fe...@atmel.com Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com Cc: Hartley Sweeten hswee...@visionengravers.com Cc: Ryan Mallon rmal...@gmail.com Cc: Ben Dooks ben-li...@fluff.org Cc: Kukjin Kim kgene@samsung.com Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/include/asm/mach/time.h |3 --- arch/arm/kernel/time.c| 14 -- arch/arm/mach-at91/at91x40_time.c |8 +--- arch/arm/mach-ebsa110/core.c |7 --- arch/arm/mach-ep93xx/core.c | 23 --- arch/arm/mach-h720x/common.c |6 +++--- arch/arm/mach-h720x/common.h |2 +- arch/arm/mach-h720x/cpu-h7201.c |3 ++- arch/arm/mach-h720x/cpu-h7202.c |3 ++- arch/arm/mach-rpc/time.c |6 +++--- arch/arm/plat-samsung/time.c |7 --- 11 files changed, 36 insertions(+), 46 deletions(-) diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index 6ca945f..cac8d9c 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -35,9 +35,6 @@ struct sys_timer { void(*init)(void); void(*suspend)(void); void(*resume)(void); -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET - unsigned long (*offset)(void); -#endif }; extern void timer_tick(void); diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index b0190b4..ea36bfa 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -69,16 +69,6 @@ unsigned long profile_pc(struct pt_regs *regs) EXPORT_SYMBOL(profile_pc); #endif -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET -static u32 arm_gettimeoffset(void) -{ - if (system_timer-offset != NULL) - return system_timer-offset() * 1000; - - return 0; -} -#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ - #ifndef CONFIG_GENERIC_CLOCKEVENTS /* * Kernel system timer support. @@ -164,10 +154,6 @@ device_initcall(timer_init_syscore_ops); void __init time_init(void) { -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET - arch_gettimeoffset = arm_gettimeoffset; -#endif - system_timer = machine_desc-timer; system_timer-init(); sched_clock_postinit(); diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c index ee06d7b..eb6151e 100644 --- a/arch/arm/mach-at91/at91x40_time.c +++ b/arch/arm/mach-at91/at91x40_time.c @@ -41,9 +41,10 @@ #defineAT91_TC_CLK1BASE0x40 #defineAT91_TC_CLK2BASE0x80 -static unsigned long at91x40_gettimeoffset(void) +static u32 at91x40_gettimeoffset(void) { - return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 100 / (AT91X40_MASTER_CLOCK / 128)); + return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 100 / + (AT91X40_MASTER_CLOCK / 128)) * 1000; } static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id) @@ -63,6 +64,8 @@ void __init at91x40_timer_init(void) { unsigned int v; + arch_gettimeoffset = at91x40_gettimeoffset; + at91_tc_write(AT91_TC_BCR, 0); v = at91_tc_read(AT91_TC_BMR); v = (v ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE; @@ -81,6 +84,5 @@ void __init at91x40_timer_init(void) struct sys_timer at91x40_timer = { .init = at91x40_timer_init, - .offset = at91x40_gettimeoffset, }; diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c index f0fe6b5..d96dd94 100644 --- a/arch/arm/mach-ebsa110/core.c +++ b/arch/arm/mach-ebsa110/core.c @@ -158,7 +158,7 @@ static void __init ebsa110_init_early(void) * interrupt, then the PIT counter will roll over (ie, be negative). * This actually works out to be convenient. */ -static unsigned long ebsa110_gettimeoffset(void) +static u32 ebsa110_gettimeoffset(void) { unsigned long offset, count; @@ -181,7 +181,7 @@ static unsigned long ebsa110_gettimeoffset(void) */ offset = offset * (100 / HZ) / COUNT; - return offset; + return offset * 1000; } static irqreturn_t @@ -215,6 +215,8 @@ static struct irqaction ebsa110_timer_irq = { */ static void __init ebsa110_timer_init(void) { + arch_gettimeoffset = ebsa110_gettimeoffset; + /* * Timer 1, mode 2, LSB/MSB */ @@ -227,7 +229,6 @@ static void __init ebsa110_timer_init(void) static struct sys_timer ebsa110_timer = { .init =
[PATCH 01/11] cris: move usec/nsec conversion to do_slow_gettimeoffset
From: Stephen Warren swar...@nvidia.com Move usec to nsec conversion from arch_gettimeoffset() to do_slow_gettimeoffset(); in a future patch, do_slow_gettimeoffset() will be used directly as the implementation of arch_gettimeoffset(), so needs to perform all required calculations. Cc: Mikael Starvik star...@axis.com Cc: Jesper Nilsson jesper.nils...@axis.com Cc: linux-cris-ker...@axis.com Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/cris/arch-v10/kernel/time.c |4 ++-- arch/cris/kernel/time.c |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c index bcffcb6..162892f 100644 --- a/arch/cris/arch-v10/kernel/time.c +++ b/arch/cris/arch-v10/kernel/time.c @@ -65,8 +65,8 @@ unsigned long do_slow_gettimeoffset(void) */ count = *R_TIMER0_DATA; - /* Convert timer value to usec */ - return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV; + /* Convert timer value to nsec */ + return (TIMER0_DIV - count) * (NSEC_PER_SEC/HZ)/TIMER0_DIV; } /* Excerpt from the Etrax100 HSDD about the built-in watchdog: diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index 277ffc4..b063c92 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c @@ -46,7 +46,7 @@ static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; u32 arch_gettimeoffset(void) { - return do_gettimeoffset() * 1000; + return do_gettimeoffset(); } #endif -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/