[Patch v2] lapic need be checked if available when initialize acpi processor id
In acpi_processor_get_info(), acpi processor info is initialized including id, namely cpu index. Currently, if on UP system running SMP kerenl with no LAPIC in MADT, cpu0_initialized is checked if acpi processor id is initialized. However this check maybe is not correct for kdump kernel. Most of time only 1 CPU is supported because of known problems. So in 1st kernel multiple CPUs are present, then crash happened in one specific CPU, say 2nd CPU. Then it jump into kdump kernel with "nr_cpus=1" specified in cmdline. In this situation, since kdump kernel is warm reset, it will reuse the ACPI resource passed from crashed kernel directly, namely 1st kernel. It means in MADT all LAPIC is enabled while only 1 CPU is present in running system. The kdump kernel usually is the same as the crashed 1st kernel. So now in kdump kernel, x86_cpu_to_apicid stored the apicid and its related cpu id. If only check cpu0_initialized, it will assign 0 to the acpi processor id of 1st CPU, it's not correct. So in this patch, check acpi_lapic too. If acpi_lapic is 0, then LAPIC in MADT is not available, assigne 0 to the handling acpi processor. If acpi_lapic is 1, then LAPIC in MADT is available, let's get apic processor id from x86_cpu_to_apicid. Signed-off-by: Baoquan He --- drivers/acpi/acpi_processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c29c2c3..33f934d 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -267,7 +267,7 @@ static int acpi_processor_get_info(struct acpi_device *device) pr->apic_id = apic_id; cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); - if (!cpu0_initialized) { + if (!cpu0_initialized && !acpi_lapic) { cpu0_initialized = 1; /* Handle UP system running SMP kernel, with no LAPIC in MADT */ if ((cpu_index == -1) && (num_online_cpus() == 1)) -- 1.8.5.3 -- 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 1/1] Driver for Beckhoff CX5020 EtherCAT master module.
On Tue, Apr 29, 2014 at 03:45:08PM -0400, David Miller wrote: > From: Darek Marcinkiewicz > Date: Mon, 28 Apr 2014 07:36:58 +0200 > > > +void *ec_bh_alloc_dma_mem(struct bh_priv *priv, > > +int channel, > > +u8 **buf, > > +dma_addr_t *phys, > > +dma_addr_t *phys_buf, > > +size_t *len) { > > + u32 mask; > > + int offset = channel * DMA_CHAN_SIZE + DMA_CHAN_OFFSET; > > + > > + iowrite32(0x, priv->dma_io + offset); > > + > > + mask = ioread32(priv->dma_io + offset); > > + mask &= 0xfffc; > > + dev_info(PRIV_TO_DEV(priv), > > +"Read mask %x for channel %d\n", > > +mask, channel); > > + *len = ~mask + 1; > > + > > + dev_info(PRIV_TO_DEV(priv), > > +"Allocating %d bytes for channel %d", > > +(int)*len, channel); > > + *buf = pci_alloc_consistent(priv->dev, > > + *len * 2, > > + phys_buf); > > This is really confusing, the log message says that it allocates > "*len" bytes, but actually you are allocating "*len * 2" bytes as > per the arguments you are passing into pci_alloc_consistent. > > Either one or the other is wrong, and if "*len * 2" is the correct > size then it should be explained why you're doubling this value > but providing just plain "*len" to the caller. > > All of these *len values seem to be doubled over and over again, > in the memset() calls, in the pci_free_consistent() calls during > resource release on probe error and driver shutdown. > > Why not just assign X * 2 to *len and get rid of this doubling all > over the place? > This device imposes some limitations on location and size of the buffers that it dma data from/to. It has a "mask" parameter saying two things: 1. RX/TX buffers have to be aligned to "mask" bits. 2. Their max size is 2^mask. In order to have a buffer meeting above criteria driver allocates chunk of size 2 * max buffer size, and half of this chunk gets used later on. So, len here is the size of that aligned buffer, whereas 2 * len is how much memory was actually allocated. So, yes, this is a little bit confusing. I'll try to clean this up a little bit and send updated patch. Thank you! -- DM -- 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 v8 1/2] dma: Add Xilinx Video DMA DT Binding Documentation
On Wed, Apr 23, 2014 at 08:23:25PM +0530, Srikanth Thokala wrote: > Device-tree binding documentation of Xilinx Video DMA Engine > > Signed-off-by: Srikanth Thokala > Acked-by: Rob Herring Applied, both Thanks -- ~Vinod -- 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 1/4] powercap/rapl: further relax energy counter checks
> -Original Message- > From: David E. Box [mailto:david.e@linux.intel.com] > Sent: Wednesday, April 30, 2014 4:03 AM > To: david.e@linux.intel.com; jacob.jun@linux.intel.com; linux- > p...@vger.kernel.org; Wysocki, Rafael J; linux-kernel@vger.kernel.org; > h...@linux.intel.com > Cc: a...@linux.intel.com; R, Durgadoss; Accardi, Kristen C > Subject: [PATCH v2 1/4] powercap/rapl: further relax energy counter checks > > From: Jacob Pan > > Energy counters may roll slowly for some RAPL domains, checking all > of them can be time consuming and takes unpredictable amount of time. > Therefore, we relax the sanity check by only checking availability of the > MSRs and non-zero value of the energy status counters. It has been shown > sufficient for all the platforms tested to filter out inactive domains. > Acked-by: Durgadoss R Thanks, Durga > Signed-off-by: Jacob Pan > --- > drivers/powercap/intel_rapl.c | 29 + > 1 file changed, 9 insertions(+), 20 deletions(-) > > diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c > index d9a0770..1c987d2 100644 > --- a/drivers/powercap/intel_rapl.c > +++ b/drivers/powercap/intel_rapl.c > @@ -1124,8 +1124,7 @@ err_cleanup_package: > static int rapl_check_domain(int cpu, int domain) > { > unsigned msr; > - u64 val1, val2 = 0; > - int retry = 0; > + u64 val = 0; > > switch (domain) { > case RAPL_DOMAIN_PACKAGE: > @@ -1144,26 +1143,13 @@ static int rapl_check_domain(int cpu, int domain) > pr_err("invalid domain id %d\n", domain); > return -EINVAL; > } > - if (rdmsrl_safe_on_cpu(cpu, msr, )) > - return -ENODEV; > - > - /* PP1/uncore/graphics domain may not be active at the time of > - * driver loading. So skip further checks. > + /* make sure domain counters are available and contains non-zero > + * values, otherwise skip it. >*/ > - if (domain == RAPL_DOMAIN_PP1) > - return 0; > - /* energy counters roll slowly on some domains */ > - while (++retry < 10) { > - usleep_range(1, 15000); > - rdmsrl_safe_on_cpu(cpu, msr, ); > - if ((val1 & ENERGY_STATUS_MASK) != (val2 & > ENERGY_STATUS_MASK)) > - return 0; > - } > - /* if energy counter does not change, report as bad domain */ > - pr_info("domain %s energy ctr %llu:%llu not working, skip\n", > - rapl_domain_names[domain], val1, val2); > + if (rdmsrl_safe_on_cpu(cpu, msr, ) || !val) > + return -ENODEV; > > - return -ENODEV; > + return 0; > } > > /* Detect active and valid domains for the given CPU, caller must > @@ -1180,6 +1166,9 @@ static int rapl_detect_domains(struct rapl_package *rp, > int cpu) > /* use physical package id to read counters */ > if (!rapl_check_domain(cpu, i)) > rp->domain_map |= 1 << i; > + else > + pr_warn("RAPL domain %s detection failed\n", > + rapl_domain_names[i]); > } > rp->nr_domains = bitmap_weight(>domain_map, > RAPL_DOMAIN_MAX); > if (!rp->nr_domains) { > -- > 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/
[PATCHv3 1/2] dt/bindings: Add the DT binding documentation for endianness
Signed-off-by: Xiubo Li --- .../devicetree/bindings/endianness/endianness.txt | 47 ++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/endianness/endianness.txt diff --git a/Documentation/devicetree/bindings/endianness/endianness.txt b/Documentation/devicetree/bindings/endianness/endianness.txt new file mode 100644 index 000..49458a1 --- /dev/null +++ b/Documentation/devicetree/bindings/endianness/endianness.txt @@ -0,0 +1,47 @@ +Device-Tree binding for device endianness + +The endianness mode of CPU & Device scenarios: +IndexCPU Device Endianess flag for DT bool property + +1LELE - +2LEBE 'big-endian{,-*}' +3BEBE - +4BELE 'little-endian{,-*}' + +For one device driver, which will run in different scenarios above +on different SoCs using the devicetree, we need one way to simplify +this. + +Required properties: +- {big,little}-endian{,-*}: this is one boolean property. + +Examples: +Scenario 1 : CPU in LE mode & device in LE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... +}; + +Scenario 2 : CPU in LE mode & device in BE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + big-endian{,-*}; +}; + +Scenario 3 : CPU in BE mode & device in BE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... +}; + +Scenario 4 : CPU in BE mode & device in LE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + little-endian{,-*}; +}; -- 1.8.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/
[PATCHv3 2/2] regmap: add DT endianness binding support.
For many drivers which will support rich endianness of CPU<-->Dev need define DT properties by itself without the binding support. The endianness using regmap: IndexCPU Device Endianess flag for DT bool property 1LELE - 2LEBE 'big-endian-{val,reg}' 3BEBE - 4BELE 'little-endian-{val,reg}' Please see the following documetation for detail: Documentation/devicetree/bindings/endianness/endianness.txt Signed-off-by: Xiubo Li --- drivers/base/regmap/regmap-i2c.c | 2 + drivers/base/regmap/regmap-spi.c | 2 + drivers/base/regmap/regmap.c | 147 --- 3 files changed, 140 insertions(+), 11 deletions(-) diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c index fa6bf52..1f603a6 100644 --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c @@ -96,6 +96,8 @@ static struct regmap_bus regmap_i2c = { .write = regmap_i2c_write, .gather_write = regmap_i2c_gather_write, .read = regmap_i2c_read, + .reg_format_endian_default = REGMAP_ENDIAN_BIG, + .val_format_endian_default = REGMAP_ENDIAN_BIG, }; /** diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c index 37f12ae..377fa29 100644 --- a/drivers/base/regmap/regmap-spi.c +++ b/drivers/base/regmap/regmap-spi.c @@ -110,6 +110,8 @@ static struct regmap_bus regmap_spi = { .async_alloc = regmap_spi_async_alloc, .read = regmap_spi_read, .read_flag_mask = 0x80, + .reg_format_endian_default = REGMAP_ENDIAN_BIG, + .val_format_endian_default = REGMAP_ENDIAN_BIG, }; /** diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 8e8cea1..946e901 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -422,6 +423,132 @@ static void regmap_range_exit(struct regmap *map) kfree(map->selector_work_buf); } +enum regmap_endian_type { + REGMAP_ENDIAN_REG, + REGMAP_ENDIAN_VAL, +}; + +/** + * of_regmap_endian_by_type() - Parse and lookup the endian referenced + * by a device node + * @np: pointer to clock consumer node + * @type: type of consumer's endian input + * + * This function parses the device endian property, and uses them to + * determine the endian of the registers and values. + */ +static int of_regmap_endian_by_type(struct device_node *np, + enum regmap_endian_type type, + enum regmap_endian *endian) +{ + if (!endian) + return -EINVAL; + + switch (type) { + case REGMAP_ENDIAN_REG: + if (of_property_read_bool(np, "big-endian-reg")) + *endian = REGMAP_ENDIAN_BIG; + else if (of_property_read_bool(np, "little-endian-reg")) + *endian = REGMAP_ENDIAN_LITTLE; + else + *endian = REGMAP_ENDIAN_NATIVE; + break; + case REGMAP_ENDIAN_VAL: + if (of_property_read_bool(np, "big-endian-val")) + *endian = REGMAP_ENDIAN_BIG; + else if (of_property_read_bool(np, "little-endian-val")) + *endian = REGMAP_ENDIAN_LITTLE; + else + *endian = REGMAP_ENDIAN_NATIVE; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int of_regmap_get_endian(struct device *dev, + const struct regmap_bus *bus, + const struct regmap_config *config, + enum regmap_endian_type type, + enum regmap_endian *endian) +{ + int ret; + + if (!endian || !config) + return -EINVAL; + + /* +* Firstly, try to parse the endian from driver's config, +* this is to be compatible with the none DT or the old drivers. +* From the driver's config the endian value maybe: +* REGMAP_ENDIAN_BIG, +* REGMAP_ENDIAN_LITTLE, +* REGMAP_ENDIAN_NATIVE, +* REGMAP_ENDIAN_DEFAULT. +*/ + switch (type) { + case REGMAP_ENDIAN_REG: + *endian = config->reg_format_endian; + break; + case REGMAP_ENDIAN_VAL: + *endian = config->val_format_endian; + break; + default: + return -EINVAL; + } + + /* +* If the endian parsing from driver's config is REGMAP_ENDIAN_DEFAULT, +* that means maybe we are using the DT node to specify the endianness. +*/ + if (*endian != REGMAP_ENDIAN_DEFAULT) +
[PATCHv3 0/2] add DT endianness binding support
Changes in V3: - Follow Mark Rutland's advice. - Document common case of the endianess usage. Changes in V2: - Namespace the properties using the prefix sring. - Add one binding ducomentation off regmap. Xiubo Li (2): dt/bindings: Add the DT binding documentation for endianness regmap: add DT endianness binding support. .../devicetree/bindings/endianness/endianness.txt | 47 +++ drivers/base/regmap/regmap-i2c.c | 2 + drivers/base/regmap/regmap-spi.c | 2 + drivers/base/regmap/regmap.c | 147 +++-- 4 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/endianness/endianness.txt -- 1.8.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 v2 2/4] usb: ehci-exynos: Use struct device instead of platform_device
Change to use struct device instead of struct platform_device for some static functions. Signed-off-by: Vivek Gautam Cc: Alan Stern Acked-by: Jingoo Han --- Changes from v1: - none drivers/usb/host/ehci-exynos.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7f425ac..4d763dc 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -50,9 +50,8 @@ struct exynos_ehci_hcd { #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv) -static void exynos_setup_vbus_gpio(struct platform_device *pdev) +static void exynos_setup_vbus_gpio(struct device *dev) { - struct device *dev = >dev; int err; int gpio; @@ -88,7 +87,7 @@ static int exynos_ehci_probe(struct platform_device *pdev) if (err) return err; - exynos_setup_vbus_gpio(pdev); + exynos_setup_vbus_gpio(>dev); hcd = usb_create_hcd(_ehci_hc_driver, >dev, dev_name(>dev)); -- 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 v2 1/4] usb: ohci-exynos: Use struct device instead of platform_device
Change to use struct device instead of struct platform_device for some static functions. Signed-off-by: Vivek Gautam Cc: Alan Stern Acked-by: Jingoo Han --- Changes from v1: - none drivers/usb/host/ohci-exynos.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 9cf80cb..05f00e3 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -39,18 +39,18 @@ struct exynos_ohci_hcd { struct usb_otg *otg; }; -static void exynos_ohci_phy_enable(struct platform_device *pdev) +static void exynos_ohci_phy_enable(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); if (exynos_ohci->phy) usb_phy_init(exynos_ohci->phy); } -static void exynos_ohci_phy_disable(struct platform_device *pdev) +static void exynos_ohci_phy_disable(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); if (exynos_ohci->phy) @@ -139,7 +139,7 @@ skip_phy: platform_set_drvdata(pdev, hcd); - exynos_ohci_phy_enable(pdev); + exynos_ohci_phy_enable(>dev); err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) { @@ -150,7 +150,7 @@ skip_phy: return 0; fail_add_hcd: - exynos_ohci_phy_disable(pdev); + exynos_ohci_phy_disable(>dev); fail_io: clk_disable_unprepare(exynos_ohci->clk); fail_clk: @@ -168,7 +168,7 @@ static int exynos_ohci_remove(struct platform_device *pdev) if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, >self); - exynos_ohci_phy_disable(pdev); + exynos_ohci_phy_disable(>dev); clk_disable_unprepare(exynos_ohci->clk); @@ -190,7 +190,6 @@ static int exynos_ohci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); - struct platform_device *pdev = to_platform_device(dev); bool do_wakeup = device_may_wakeup(dev); int rc = ohci_suspend(hcd, do_wakeup); @@ -200,7 +199,7 @@ static int exynos_ohci_suspend(struct device *dev) if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, >self); - exynos_ohci_phy_disable(pdev); + exynos_ohci_phy_disable(dev); clk_disable_unprepare(exynos_ohci->clk); @@ -211,14 +210,13 @@ static int exynos_ohci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); - struct platform_device *pdev= to_platform_device(dev); clk_prepare_enable(exynos_ohci->clk); if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, >self); - exynos_ohci_phy_enable(pdev); + exynos_ohci_phy_enable(dev); ohci_resume(hcd, false); -- 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 v10 4/4] usb: ehci-exynos: Change to use phy provided by the generic phy framework
From: Kamil Debski Add the phy provider, supplied by new Exynos-usb2phy using Generic phy framework. Keeping the support for older USB phy intact right now, in order to prevent any functionality break in absence of relevant device tree side change for ehci-exynos. Once we move to new phy in the device nodes for ehci, we can remove the support for older phys. Signed-off-by: Kamil Debski [gautam.vi...@samsung.com: Addressed review comments from mailing list] [gautam.vi...@samsung.com: Kept the code for old usb-phy, and just added support for new exynos5-usb2phy in generic phy framework] [gautam.vi...@samsung.com: Edited the commit message] Signed-off-by: Vivek Gautam Cc: Jingoo Han Cc: Alan Stern --- Changes from v9: - Calling usb_phy_shutdown() when exynos_ehci_phy_enable() is failing. - Made exynos_ehci_phy_disable() return void, since its return value did not serve any purpose. - Calling clk_disable_unprepare() in exynos_ehci_resume() when exynos_ehci_phy_enable() is failed. .../devicetree/bindings/usb/exynos-usb.txt | 18 +++ drivers/usb/host/ehci-exynos.c | 144 +--- 2 files changed, 142 insertions(+), 20 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt b/Documentation/devicetree/bindings/usb/exynos-usb.txt index a90c973..126a7a9 100644 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt @@ -12,6 +12,15 @@ Required properties: - interrupts: interrupt number to the cpu. - clocks: from common clock binding: handle to usb clock. - clock-names: from common clock binding: Shall be "usbhost". + - port: if in the SoC there are EHCI phys, they should be listed here. + One phy per port. Each port should have following entries: + - reg: port number on EHCI controller, e.g + On Exynos5250, port 0 is USB2.0 otg phy + port 1 is HSIC phy0 + port 2 is HSIC phy1 + - phys: from the *Generic PHY* bindings; specifying phy used by port. + - phy-names: from the *Generic PHY* bindings; specifying name of phy +used by the port. Optional properties: - samsung,vbus-gpio: if present, specifies the GPIO that @@ -27,6 +36,15 @@ Example: clocks = < 285>; clock-names = "usbhost"; + + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + phys = < 1>; + phy-names = "host"; + status = "disabled"; + }; }; OHCI diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 4d763dc..931cfc8 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -42,14 +43,119 @@ static const char hcd_name[] = "ehci-exynos"; static struct hc_driver __read_mostly exynos_ehci_hc_driver; +#define PHY_NUMBER 3 struct exynos_ehci_hcd { struct clk *clk; struct usb_phy *phy; struct usb_otg *otg; + struct phy *phy_g[PHY_NUMBER]; }; #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv) +static int exynos_ehci_get_phy(struct device *dev, + struct exynos_ehci_hcd *exynos_ehci) +{ + struct device_node *child; + struct phy *phy; + int phy_number; + int ret = 0; + + exynos_ehci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(exynos_ehci->phy)) { + ret = PTR_ERR(exynos_ehci->phy); + /* This is the case when PHY config is disabled */ + if (ret == -ENXIO || ret == -ENODEV) { + dev_dbg(dev, "Failed to get usb2 phy\n"); + exynos_ehci->phy = NULL; + ret = 0; + } else if (ret == -EPROBE_DEFER) { + goto fail_phy; + } else { + dev_err(dev, "no usb2 phy configured\n"); + goto fail_phy; + } + } else { + exynos_ehci->otg = exynos_ehci->phy->otg; + } + + for_each_available_child_of_node(dev->of_node, child) { + ret = of_property_read_u32(child, "reg", _number); + if (ret) { + dev_err(dev, "Failed to parse device tree\n"); + of_node_put(child); + goto fail_phy; + } + if (phy_number >= PHY_NUMBER) { + dev_err(dev, "Invalid number of PHYs\n"); + of_node_put(child); + ret = -EINVAL; + goto fail_phy; + } + phy = devm_of_phy_get(dev, child, 0); +
[PATCH v4 3/4] usb: ohci-exynos: Add facility to use phy provided by the generic phy framework
Add support to consume phy provided by Generic phy framework. Keeping the support for older usb-phy intact right now, in order to prevent any functionality break in absence of relevant device tree side change for ohci-exynos. Once we move to new phy in the device nodes for ohci, we can remove the support for older phys. Signed-off-by: Vivek Gautam Cc: Jingoo Han Cc: Alan Stern --- Changes from v3: - Calling usb_phy_shutdown() when exynos_ohci_phy_enable() is failing. - Made exynos_ohci_phy_disable() return void, since its return value did not serve any purpose. - Calling clk_disable_unprepare() in exynos_ohci_resume() when exynos_ohci_phy_enable() is failed. .../devicetree/bindings/usb/exynos-usb.txt | 19 +++ drivers/usb/host/ohci-exynos.c | 128 +--- 2 files changed, 132 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt b/Documentation/devicetree/bindings/usb/exynos-usb.txt index d967ba1..a90c973 100644 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt @@ -38,6 +38,15 @@ Required properties: - interrupts: interrupt number to the cpu. - clocks: from common clock binding: handle to usb clock. - clock-names: from common clock binding: Shall be "usbhost". + - port: if in the SoC there are OHCI phys, they should be listed here. + One phy per port. Each port should have following entries: + - reg: port number on OHCI controller, e.g + On Exynos5250, port 0 is USB2.0 otg phy + port 1 is HSIC phy0 + port 2 is HSIC phy1 + - phys: from the *Generic PHY* bindings, specifying phy used by port. + - phy-names: from the *Generic PHY* bindings, specifying name of phy +used by the port. Example: usb@1212 { @@ -47,6 +56,16 @@ Example: clocks = < 285>; clock-names = "usbhost"; + + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + phys = < 1>; + phy-names = "host"; + status = "disabled"; + }; + }; DWC3 diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 05f00e3..f90bf9a 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -33,28 +34,122 @@ static struct hc_driver __read_mostly exynos_ohci_hc_driver; #define to_exynos_ohci(hcd) (struct exynos_ohci_hcd *)(hcd_to_ohci(hcd)->priv) +#define PHY_NUMBER 3 struct exynos_ohci_hcd { struct clk *clk; struct usb_phy *phy; struct usb_otg *otg; + struct phy *phy_g[PHY_NUMBER]; }; -static void exynos_ohci_phy_enable(struct device *dev) +static int exynos_ohci_get_phy(struct device *dev, + struct exynos_ohci_hcd *exynos_ohci) +{ + struct device_node *child; + struct phy *phy; + int phy_number; + int ret = 0; + + exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(exynos_ohci->phy)) { + ret = PTR_ERR(exynos_ohci->phy); + /* This is the case when PHY config is disabled */ + if (ret == -ENXIO || ret == -ENODEV) { + dev_dbg(dev, "Failed to get usb2 phy\n"); + exynos_ohci->phy = NULL; + ret = 0; + } else if (ret == -EPROBE_DEFER) { + goto fail_phy; + } else { + dev_err(dev, "no usb2 phy configured\n"); + goto fail_phy; + } + } else { + exynos_ohci->otg = exynos_ohci->phy->otg; + } + + /* Getting generic phy: +* We are keeping both types of phys as a part of transiting OHCI +* to generic phy framework, so that in absence of supporting dts +* changes the functionality doesn't break. +* Once we move the ohci dt nodes to use new generic phys, +* we can remove support for older PHY in this driver. +*/ + for_each_available_child_of_node(dev->of_node, child) { + ret = of_property_read_u32(child, "reg", _number); + if (ret) { + dev_err(dev, "Failed to parse device tree\n"); + of_node_put(child); + goto fail_phy; + } + if (phy_number >= PHY_NUMBER) { + dev_err(dev, "Invalid number of PHYs\n"); + of_node_put(child); + ret = -EINVAL; + goto fail_phy; + } + phy = devm_of_phy_get(dev, child, 0); +
Re: [PATCH] mbcache: LLVMLinux: Remove double calculation from mbcache
On 04/29/2014 06:13 PM, H. Peter Anvin wrote: > I suspect this will generate FP instructions on x86 which will corrupt user > space state. This is thus a critical bug!! It looks like at least x86-64 gcc does the evaluation at compile time and there aren't any fp instructions left in the code. However, it should still be fixed. -hpa -- 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] powerpc 32: Provides VIRT_CPU_ACCOUNTING
On Mon, 2014-04-07 at 09:31 +0200, Christophe Leroy wrote: > This patch provides VIRT_CPU_ACCOUTING to PPC32 architecture. > Unlike PPC64, PPC32 doesn't use the PACA convention. Therefore the > implementation is taken from the IA64 architecture. > It is based on additional information added to the Task Info structure. > > Signed-off-by: Christophe Leroy Scott, Can you review/ack this (or get somebody to) ? It looks like a great idea but I really don't have the bandwidth to review in detail and test right now. (Adding Alister as well who maintains our 4xx 32-bit stuff nowadays). Cheers, Ben. > Index: b/arch/powerpc/Kconfig > === > --- a/arch/powerpc/Kconfig(revision 5607) > +++ b/arch/powerpc/Kconfig(revision 5611) > @@ -138,6 +138,7 @@ > select OLD_SIGSUSPEND > select OLD_SIGACTION if PPC32 > select HAVE_DEBUG_STACKOVERFLOW > + select HAVE_VIRT_CPU_ACCOUNTING > > config EARLY_PRINTK > bool > Index: a/arch/powerpc/kernel/time.c > === > --- a/arch/powerpc/kernel/time.c (revision 5607) > +++ b/arch/powerpc/kernel/time.c (revision 5611) > @@ -162,7 +162,9 @@ > > cputime_t cputime_one_jiffy; > > +#ifdef CONFIG_PPC_SPLPAR > void (*dtl_consumer)(struct dtl_entry *, u64); > +#endif > > static void calc_cputime_factors(void) > { > @@ -178,6 +180,7 @@ > __cputime_clockt_factor = res.result_low; > } > > +#ifdef CONFIG_PPC64 > /* > * Read the SPURR on systems that have it, otherwise the PURR, > * or if that doesn't exist return the timebase value passed in. > @@ -190,6 +193,7 @@ > return mfspr(SPRN_PURR); > return tb; > } > +#endif > > #ifdef CONFIG_PPC_SPLPAR > > @@ -291,6 +295,7 @@ > * Account time for a transition between system, hard irq > * or soft irq state. > */ > +#ifdef CONFIG_PPC64 > static u64 vtime_delta(struct task_struct *tsk, > u64 *sys_scaled, u64 *stolen) > { > @@ -377,7 +382,70 @@ > get_paca()->utime_sspurr = 0; > account_user_time(tsk, utime, utimescaled); > } > +#else > > +void vtime_account_user(struct task_struct *tsk) > +{ > + cputime_t delta_utime; > + struct thread_info *ti = task_thread_info(tsk); > + > + if (ti->ac_utime) { > + delta_utime = ti->ac_utime; > + account_user_time(tsk, delta_utime, delta_utime); > + ti->ac_utime = 0; > + } > +} > + > +/* > + * Called from the context switch with interrupts disabled, to charge all > + * accumulated times to the current process, and to prepare accounting on > + * the next process. > + */ > +void arch_vtime_task_switch(struct task_struct *prev) > +{ > + struct thread_info *pi = task_thread_info(prev); > + struct thread_info *ni = task_thread_info(current); > + > + ni->ac_stamp = pi->ac_stamp; > + ni->ac_stime = ni->ac_utime = 0; > +} > + > +/* > + * Account time for a transition between system, hard irq or soft irq state. > + * Note that this function is called with interrupts enabled. > + */ > +static cputime_t vtime_delta(struct task_struct *tsk) > +{ > + struct thread_info *ti = task_thread_info(tsk); > + __u32 delta_stime; > + __u32 now; > + > + WARN_ON_ONCE(!irqs_disabled()); > + > + now = mftbl(); > + > + delta_stime = ti->ac_stime + (now - ti->ac_stamp); > + ti->ac_stime = 0; > + ti->ac_stamp = now; > + > + return (cputime_t)delta_stime; > +} > + > +void vtime_account_system(struct task_struct *tsk) > +{ > + cputime_t delta = vtime_delta(tsk); > + > + account_system_time(tsk, 0, delta, delta); > +} > +EXPORT_SYMBOL_GPL(vtime_account_system); > + > +void vtime_account_idle(struct task_struct *tsk) > +{ > + account_idle_time(vtime_delta(tsk)); > +} > + > +#endif > + > #else /* ! CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ > #define calc_cputime_factors() > #endif > @@ -871,6 +939,8 @@ > ppc_proc_freq / 100, ppc_proc_freq % 100); > } > > + mttbl(0); > + mttbu(0); > tb_ticks_per_jiffy = ppc_tb_freq / HZ; > tb_ticks_per_sec = ppc_tb_freq; > tb_ticks_per_usec = ppc_tb_freq / 100; > Index: b/arch/powerpc/kernel/entry_32.S > === > --- a/arch/powerpc/kernel/entry_32.S (revision 5607) > +++ b/arch/powerpc/kernel/entry_32.S (revision 5611) > @@ -177,6 +177,12 @@ > addir12,r12,-1 > stw r12,4(r11) > #endif > +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > + CURRENT_THREAD_INFO(r9, r1) > + tophys(r9, r9) > + ACCOUNT_CPU_USER_ENTRY(r9, r11, r12) > +#endif > + > b 3f > > 2: /* if from kernel, check interrupted DOZE/NAP mode and > @@ -406,6 +412,13 @@ > lwarx r7,0,r1 > END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) > stwcx. r0,0,r1 /* to clear the reservation */ >
Re: [PATCH] ACPI/Processor: Fix failure of loading acpi-cpufreq driver
Hi Tianyu, Found another issue at the second glance. In case of x2apic, "if (apic_id < 0)" should be replaced by "if (apic_id == -1)" for safety. Best Regards! Gerry On 2014/4/30 13:08, Jiang Liu wrote: > Hi Tianyu, > With the suggested fix, we still need to protect > acpi_processor_hotadd_init() when pr->apic_id is -1, > otherwise it may cause invalid memory access. > > Best Regards! > Gerry > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index c29c2c3ec0ad..e17befc54c34 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(struct > acpi_processor *pr) > acpi_status status; > int ret; > > + if (pr->apic_id < 0) > + return -ENODEV; > + > status = acpi_evaluate_integer(pr->handle, "_STA", NULL, ); > if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) > return -ENODEV; > > > On 2014/4/30 11:10, Lan Tianyu wrote: >> According commit d640113fe(ACPI: processor: fix acpi_get_cpuid for UP >> processor), Bios may not provide _MAT or MADT tables and acpi_get_apicid() >> always returns -1. For these cases, original code will pass apic_id with >> vaule of -1 to acpi_map_cpuid() and it will check the acpi_id. If acpi_id >> is equal to zero, ignores apic_id and return zero for CPU0. >> >> Commit b981513(ACPI / scan: bail out early if failed to parse APIC >> ID for CPU) changed the behavior. Return ENODEV when find apic_id is >> less than zero after calling acpi_get_apicid(). This causes acpi-cpufreq >> driver fails to be loaded on some machines. This patch is to fix it. >> >> Reference:https://bugzilla.kernel.org/show_bug.cgi?id=73781 >> Cc: sta...@vger.kernel.org v3.14 >> Reported-and-tested-by: KATO Hiroshi >> Reported-and-tested-by: Stuart Foster >> Signed-off-by: Lan Tianyu >> --- >> drivers/acpi/acpi_processor.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c >> index c29c2c3..d55b603 100644 >> --- a/drivers/acpi/acpi_processor.c >> +++ b/drivers/acpi/acpi_processor.c >> @@ -260,10 +260,8 @@ static int acpi_processor_get_info(struct acpi_device >> *device) >> } >> >> apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); >> -if (apic_id < 0) { >> +if (apic_id < 0) >> acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); >> -return -ENODEV; >> -} >> pr->apic_id = apic_id; >> >> cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); >> > -- > 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/ > -- 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] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
On 04/29/2014 10:08 PM, Andrew Pinski wrote: > > restoring the values is hard since even the ptrace interface does not > allow for that. > So that begs the ultimate question, which is: given the fact that there is *state missing* from the state vector (this is the core of the problem), is there a way we can add that state so that gdb will be able to save and restore it? -hpa -- 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/1] Revert "affs: use ->kill_sb() to simplify ->put_super() and failure exits of ->mount()"
On Tue, 29 Apr 2014 15:30:22 -0700 Andrew Morton wrote: > On Tue, 29 Apr 2014 21:35:12 +0200 Fabian Frederick wrote: > > > This reverts commit 842a859db26b70 due to permanent crash issues. > > > > Sample scenario: > > > > dd if=/dev/zero of=f1 bs=1M count=1 > > losetup -f f1 > > mount -t affs -o unknownoption /dev/loop0 mnt1 > > -> crash > > Thanks for the bug report ;) Sorry, it was only tested under X window and box was completely frozen. I guess Al can test with the simple steps above or I can make a complete console report. > > > With patch revert: > > "mount: wrong fs type, bad option, bad superblock on /dev/loop0" > > But reverting is premature. With this info Al will presumably fix this up. Of course :) -- 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: [PATCHv2 1/3] dt/bindings: Add the DT binding documentation for endianness
> > diff --git a/Documentation/devicetree/bindings/endianness/endianness.txt > b/Documentation/devicetree/bindings/endianness/endianness.txt > > new file mode 100644 > > index 000..64f1d5e > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/endianness/endianness.txt > > @@ -0,0 +1,55 @@ > > +Device-Tree binding for device endianness > > + > > +The endianness mode of CPU & Device scenarios: > > + IndexCPU Device > > + > > + 1LE LE > > + 2LE BE > > + 3BE BE > > + 4BE LE > > + > > +For one device driver, which will run in different scenarios above > > +on different SoCs using the devicetree, we need one way to simplify > > +this. > > + > > +Required properties: > > +- [prefix]-endian: this is one string property and must be one > > + of 'be', 'le' and 'native' if it is present. > > What exactly is the prefix? > > This file name and file heading implies this is a common endianness > binding, which it is not. There are many existing bindings that have > mechanisms for describing the endianness of components, and they have > settled on a different pattern. > > We already have many bindings with {big,little}-endian{,-*} boolean > properties. It would be better to take that common case and document > that as the standard way of doing things rather than inventing a > completely different mechanism. > Well, yes, I'll follow your advice. > > +The endianness mode: > > + 'le' : device is in little endian mode, > > + 'be' : device is in big endian mode, > > + 'native' : device is in the same endian mode with the CPU. > > What exactly do you mean by native? A device which always matches the > endianness of the CPU even if it changes? How common is that? > It's originally based the regmap, and the 'native' is make no sense here, I'll reconstruct this. > > + > > +Examples: > > +Scenario 1 : CPU in LE mode & device in LE mode. > > +dev: dev@40031000 { > > + compatible = "name"; > > + reg = <0x40031000 0x1000>; > > + ... > > + [prefix]-endian = 'native'; > > +}; > > If the device is LE, then surely we should describe the device as LE. > The kernel knows what endianness it is, might choose to change the CPU > endianness, but regardless can do the right thing. Telling it a device > is native is useless unless the device changes endianness with the CPU. > Yes, you are right. > > + > > +Scenario 2 : CPU in LE mode & device in BE mode. > > +dev: dev@40031000 { > > + compatible = "name"; > > + reg = <0x40031000 0x1000>; > > + ... > > + [prefix]-endian = 'be'; > > +}; > > + > > +Scenario 3 : CPU in BE mode & device in BE mode. > > +dev: dev@40031000 { > > + compatible = "name"; > > + reg = <0x40031000 0x1000>; > > + ... > > + [prefix]-endian = 'native'; > > +}; > > Likewise. > > Thanks, > Mark. > -- 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] ACPI/Processor: Fix failure of loading acpi-cpufreq driver
Hi Tianyu, With the suggested fix, we still need to protect acpi_processor_hotadd_init() when pr->apic_id is -1, otherwise it may cause invalid memory access. Best Regards! Gerry diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c29c2c3ec0ad..e17befc54c34 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) acpi_status status; int ret; + if (pr->apic_id < 0) + return -ENODEV; + status = acpi_evaluate_integer(pr->handle, "_STA", NULL, ); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) return -ENODEV; On 2014/4/30 11:10, Lan Tianyu wrote: > According commit d640113fe(ACPI: processor: fix acpi_get_cpuid for UP > processor), Bios may not provide _MAT or MADT tables and acpi_get_apicid() > always returns -1. For these cases, original code will pass apic_id with > vaule of -1 to acpi_map_cpuid() and it will check the acpi_id. If acpi_id > is equal to zero, ignores apic_id and return zero for CPU0. > > Commit b981513(ACPI / scan: bail out early if failed to parse APIC > ID for CPU) changed the behavior. Return ENODEV when find apic_id is > less than zero after calling acpi_get_apicid(). This causes acpi-cpufreq > driver fails to be loaded on some machines. This patch is to fix it. > > Reference:https://bugzilla.kernel.org/show_bug.cgi?id=73781 > Cc: sta...@vger.kernel.org v3.14 > Reported-and-tested-by: KATO Hiroshi > Reported-and-tested-by: Stuart Foster > Signed-off-by: Lan Tianyu > --- > drivers/acpi/acpi_processor.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index c29c2c3..d55b603 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -260,10 +260,8 @@ static int acpi_processor_get_info(struct acpi_device > *device) > } > > apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); > - if (apic_id < 0) { > + if (apic_id < 0) > acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); > - return -ENODEV; > - } > pr->apic_id = apic_id; > > cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); > -- 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] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
On Tue, Apr 29, 2014 at 9:50 PM, H. Peter Anvin wrote: > On 04/29/2014 08:44 PM, Hui Zhu wrote: >> >> I am sorry that the root cause of issue has something wrong. >> The right root cause is: >> When inferior call 32 bits syscall "read", Linux kernel function >> "ia32_cstar_target" will set TS_COMPAT to current_thread_info->status. >> >> syscall read is interrupt by ctrl-c. Then the $rax will be set to >> errno -512 in 64 bits. >> And the inferior will be stopped by Linux kernel function ptrace_stop, >> the call trace is: >> #0 freezable_schedule () at include/linux/freezer.h:172 >> #1 ptrace_stop (exit_code=exit_code@entry=5, why=why@entry=262148, >> clear_code=clear_code@entry=0, info=info@entry=0x88001d833e78) >> at kernel/signal.c:1920 >> #2 0x8107ec33 in ptrace_signal (info=0x88001d833e78, signr=5) >> at kernel/signal.c:2157 >> #3 get_signal_to_deliver (info=info@entry=0x88001d833e78, >> return_ka=return_ka@entry=0x88001d833e58, regs=, >> cookie=cookie@entry=0x0 ) at kernel/signal.c:2269 >> #4 0x81013438 in do_signal (regs=regs@entry=0x88001d833f58) >> at arch/x86/kernel/signal.c:696 >> #5 0x81013a40 in do_notify_resume (regs=0x88001d833f58, >> unused=, thread_info_flags=4) at >> arch/x86/kernel/signal.c:747 >> #6 >> #7 0x in irq_stack_union () >> >> After that, GDB can control the stopped inferior. >> To call function "func1()" of inferior, GDB need: >> Step 1, save current values of registers ($rax 0xfe00(64 bits >> -512) >> is cut to 0xfe00(32 bits -512) because inferior is a 32 bits program). > > So gdb just corrupted the system state. Except GDB in 32bit mode does not know the registers are full 64bits so ... > >> Step 2, change the values of registers. >> Step 3, Push a dummy frame to stack. >> Step 4, set a breakpint in the return address. >> >> When GDB resume the inferior, it will keep execut from ptrace_stop >> with new values of registers that set by GDB. > >> And TS_COMPAT inside current_thread_info->status will be cleared when >> inferior switch back to user space. > > As it should, because TS_COMPAT *only is meaningful while a system call > is executing*. > >> When function "func1()" return, inferior will be stoped by breakpoint >> inferior will be stopped by Linux kernel function "ptrace_stop" again. >> current_thread_info->status will not set TS_COMPAT when inferior swith >> from user space to kernel space because breakpoint handler "int3" doesn't >> has code for that. > > As it shouldn't, because there is no system call entry involved. > >> GDB begin to set saved values of registers back to inferior that use >> function "amd64_collect_native_gregset". Because this function just >> zero-extend each 32 bits value to 64 bits value before put them to inferior. >> $rax's value is set to 0xfe00(32 bits -512) but not >> 0xfe00(64 bits -512). >> >> When GDB continue syscall "read" that is interrupted by "ctrl-c", it will >> keep execute from ptrace_stop without "TS_COMPAT". > > gdb has corrupted the state, and it fails to execute. > > I'm wondering if we need to add additional state here, to carry the > TS_COMPAT bit. We have talked about this kind of issues in the past. > >> Then in Linux kernel function "syscall_get_error", >> current_thread_info->status >> doesn't have TS_COMPAT and $rax is 0xfe00(32 bits -512). Then in >> function do_signal will not handle this -ERESTARTSYS. >> >> -ERESTARTSYS will be return back to inferior, that is why inferior got a >> errno -ERESTARTSYS. >> >> I made a new patch that before call do_notify_resume(will call do_signal) >> in the int3 handler, set TS_COMPAT to status if this task is TIF_IA32. >> Then after GDB call a function of inferior, it will still has TS_COMPAT. > > I'm not sure if I want to label this a gdb bug or not (my main feeling > is that gdb should save and restore the register set presented to it, > and that truncating values to 32 bits is the root of the problem), but > the above is definitely a hack which doesn't really address the real > problem. restoring the values is hard since even the ptrace interface does not allow for that. Thanks, Andrew Pinski > > -hpa > -- 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 09/12] ARM: EXYNOS: Refactored code for using PMU address via DT
Under "arm/mach-exynos" many files are using PMU register offsets. Since we have added support for accessing PMU base address via DT, now we can remove PMU mapping from exynosX_iodesc. Let's convert all these access using either of iomapped address or regmap handle. This will help us in removing static mapping of PMU base address as well as help in reducing dependency over machine header files. Thus helping for migration of PMU implementation from machine to driver folder which can be reused for ARM64 bsed SoC. CC: Ben Dooks CC: Kyungmin Park CC: Arnd Bergmann Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h|4 +- arch/arm/mach-exynos/exynos.c| 19 +- arch/arm/mach-exynos/hotplug.c |4 +- arch/arm/mach-exynos/include/mach/map.h |3 - arch/arm/mach-exynos/platsmp.c | 38 +- arch/arm/mach-exynos/pm.c| 77 ++-- arch/arm/mach-exynos/pmu.c | 40 +- arch/arm/mach-exynos/regs-pmu.h | 506 +- arch/arm/plat-samsung/include/plat/map-s5p.h |1 - 9 files changed, 362 insertions(+), 330 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 33a2bee..2922f20 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -37,7 +37,7 @@ extern void exynos_cpu_die(unsigned int cpu); /* PMU(Power Management Unit) support */ -#define PMU_TABLE_END NULL +#define PMU_TABLE_END (-1U) enum sys_powerdown { SYS_AFTR, @@ -48,7 +48,7 @@ enum sys_powerdown { extern unsigned long l2x0_regs_phys; struct exynos_pmu_conf { - void __iomem *reg; + unsigned int offset; unsigned int val[NUM_SYS_POWERDOWN]; }; diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 9045fd6..a59b122 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -66,11 +67,6 @@ static struct map_desc exynos4_iodesc[] __initdata = { .length = SZ_4K, .type = MT_DEVICE, }, { - .virtual= (unsigned long)S5P_VA_PMU, - .pfn= __phys_to_pfn(EXYNOS4_PA_PMU), - .length = SZ_64K, - .type = MT_DEVICE, - }, { .virtual= (unsigned long)S5P_VA_COMBINER_BASE, .pfn= __phys_to_pfn(EXYNOS4_PA_COMBINER), .length = SZ_4K, @@ -194,11 +190,6 @@ static struct map_desc exynos5_iodesc[] __initdata = { .pfn= __phys_to_pfn(EXYNOS5_PA_CMU), .length = 144 * SZ_1K, .type = MT_DEVICE, - }, { - .virtual= (unsigned long)S5P_VA_PMU, - .pfn= __phys_to_pfn(EXYNOS5_PA_PMU), - .length = SZ_64K, - .type = MT_DEVICE, }, }; @@ -206,7 +197,7 @@ static void exynos_restart(enum reboot_mode mode, const char *cmd) { struct device_node *np; u32 val = 0x1; - void __iomem *addr = EXYNOS_SWRESET; + void __iomem *addr = NULL; if (of_machine_is_compatible("samsung,exynos5440")) { u32 status; @@ -219,9 +210,9 @@ static void exynos_restart(enum reboot_mode mode, const char *cmd) val = __raw_readl(addr); val = (val & 0x) | (status & 0x); - } - - __raw_writel(val, addr); + __raw_writel(val, addr); + } else + regmap_write(exynos_pmu_regmap, EXYNOS_SWRESET, val); } static struct platform_device exynos_cpuidle = { diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 73b0b5c..0243ef3 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -91,11 +92,12 @@ static inline void cpu_leave_lowpower(void) static inline void platform_do_lowpower(unsigned int cpu, int *spurious) { + struct regmap *pmu_regmap = get_exynos_pmuregmap(); for (;;) { /* make cpu1 to be turned off at next WFI command */ if (cpu == 1) - __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); + regmap_write(pmu_regmap, S5P_ARM_CORE1_CONFIGURATION, 0); /* * here's the WFI diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 7b046b5..1ba7fb5 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -35,9 +35,6 @@ #define EXYNOS4_PA_SYSCON 0x1001 #define EXYNOS5_PA_SYSCON 0x10050100 -#define
[PATCH v3 06/12] ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain
From: Young-Gun Jang Current "pm_domain.c" file uses "S5P_INT_LOCAL_PWR_EN" definition from "regs-pmu.h" and hence needs to include this header file. As there is no other user of "S5P_INT_LOCAL_PWR_EN" definition other than pm_domain, to remove "regs-pmu.h" header file dependency from "pm_domain.c" it's better we define this definition in "pm_domain.c" file itself and thus it will help in removing header file inclusion from "pm_domain.c". Also removing "S5P_" prefix from macro. Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/pm_domains.c |8 arch/arm/mach-exynos/regs-pmu.h |1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index fe6570e..e45d288 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -22,7 +22,7 @@ #include #include -#include "regs-pmu.h" +#define INT_LOCAL_PWR_EN 0x7 /* * Exynos specific wrapper around the generic power domain @@ -44,13 +44,13 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) pd = container_of(domain, struct exynos_pm_domain, pd); base = pd->base; - pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0; + pwr = power_on ? INT_LOCAL_PWR_EN : 0; __raw_writel(pwr, base); /* Wait max 1ms */ timeout = 10; - while ((__raw_readl(base + 0x4) & S5P_INT_LOCAL_PWR_EN) != pwr) { + while ((__raw_readl(base + 0x4) & INT_LOCAL_PWR_EN) != pwr) { if (!timeout) { op = (power_on) ? "enable" : "disable"; pr_err("Power domain %s %s failed\n", domain->name, op); @@ -172,7 +172,7 @@ static __init int exynos4_pm_init_power_domain(void) platform_set_drvdata(pdev, pd); - on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; + on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN; pm_genpd_init(>pd, NULL, !on); } diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index b68b5cc..fd8a19d 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -116,7 +116,6 @@ #define S5P_PAD_RET_EBIB_OPTIONS5P_PMUREG(0x31A8) #define S5P_CORE_LOCAL_PWR_EN 0x3 -#define S5P_INT_LOCAL_PWR_EN 0x7 /* Only for EXYNOS4210 */ #define S5P_CMU_CLKSTOP_LCD1_LOWPWRS5P_PMUREG(0x1154) -- 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 v3 07/12] ARM: EXYNOS: Add support for mapping PMU base address via DT
From: Young-Gun Jang Add support for mapping Samsung Power Management Unit (PMU) base address from device tree. This patch also adds helper function as "get_exynos_pmuregmap". This function can be used by other machine files such as "pm.c", "hotplug.c" for accessing PMU regmap handle. Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/Kconfig |2 ++ arch/arm/mach-exynos/common.h |2 ++ arch/arm/mach-exynos/exynos.c | 39 +++ 3 files changed, 43 insertions(+) diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index fc8bf18..2f60c90 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -26,6 +26,7 @@ config ARCH_EXYNOS4 select PINCTRL select PM_GENERIC_DOMAINS if PM_RUNTIME select S5P_DEV_MFC + select MFD_SYSCON help Samsung EXYNOS4 SoCs based systems @@ -36,6 +37,7 @@ config ARCH_EXYNOS5 select HAVE_ARM_SCU if SMP select HAVE_SMP select PINCTRL + select MFD_SYSCON help Samsung EXYNOS5 (Cortex-A15) SoC based systems diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 8a4aa0b..33a2bee 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -55,4 +55,6 @@ struct exynos_pmu_conf { extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); extern void exynos_enter_aftr(void); +extern struct regmap *get_exynos_pmuregmap(void); + #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index a7b45db..9045fd6 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,8 @@ #define L2_AUX_VAL 0x7C470001 #define L2_AUX_MASK 0xC200 +static struct regmap *exynos_pmu_regmap; + static struct map_desc exynos4_iodesc[] __initdata = { { .virtual= (unsigned long)S3C_VA_SYS, @@ -260,6 +263,14 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, return 1; } +static const struct of_device_id exynos_dt_pmu_match[] = { + { .compatible = "samsung,exynos4210-pmu" }, + { .compatible = "samsung,exynos4212-pmu" }, + { .compatible = "samsung,exynos4412-pmu" }, + { .compatible = "samsung,exynos5250-pmu" }, + {}, +}; + /* * exynos_map_io * @@ -327,6 +338,32 @@ static int __init exynos4_l2x0_cache_init(void) } early_initcall(exynos4_l2x0_cache_init); + +struct regmap *get_exynos_pmuregmap() +{ + return exynos_pmu_regmap; +} + +void __init exynos_map_pmu(void) +{ + struct device_node *np = NULL; + + early_syscon_init(); + + np = of_find_matching_node(NULL, exynos_dt_pmu_match); + + if (!np) { + pr_err("Failed to find PMU node\n"); + return; + } else { + exynos_pmu_regmap = syscon_early_regmap_lookup_by_phandle(np, + "samsung,syscon-phandle"); + } + + if (IS_ERR(exynos_pmu_regmap)) + pr_err("failed to find exynos_pmu_regmap\n"); +} + static void __init exynos_dt_machine_init(void) { struct device_node *i2c_np; @@ -355,6 +392,8 @@ static void __init exynos_dt_machine_init(void) } } + exynos_map_pmu(); + if (!soc_is_exynos5440()) platform_device_register(_cpuidle); -- 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 v3 10/12] ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c
As we have removed static mappings from "regs-pmu.h" it does not need map.h anymore. But "platsmp.c" needed this and till now it got included indirectly. So lets move header inclusion of "mach/map.h" from "regs-pmu.h" to "platsmp.c". Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/platsmp.c |1 + arch/arm/mach-exynos/regs-pmu.h |2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 375ea4e..8f3b866 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -27,6 +27,7 @@ #include #include +#include #include "common.h" #include "regs-pmu.h" diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index a72b1bc..1d83c7e 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -12,8 +12,6 @@ #ifndef __ASM_ARCH_REGS_PMU_H #define __ASM_ARCH_REGS_PMU_H __FILE__ -#include - #define S5P_CENTRAL_SEQ_CONFIGURATION 0x0200 #define S5P_CENTRAL_LOWPWR_CFG (1 << 16) -- 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 v3 00/12] ARM: Exynos: PMU cleanup and refactoring for using DT
This patch series, does some minor cleanup of exynos machine files. It also modifies Exynos Power Management Unit (PMU) related code for converting it into a platform_driver. This is also preparation for moving PMU related code out of machine folder into a either "drivers/mfd", or "drivers/power" or some other suitable place so that ARM64 based SoC can utilize common piece of code. These patches require change in Exynos SoC dtsi files, which has been posted as separate patch series [2] These patches are created on top of Kukjin Kim's for-next (v3.15-rc1 tag) branch and on top of Daniel Lezcano's Exynos cpuidle refactor patches [3]. These patches depends on following three patch series: [1] mfd: syscon: Support early initialization https://lkml.org/lkml/2014/4/8/239 [2] Add PMU node for Exynos SoCs http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg29329.html [3] http://thread.gmane.org/gmane.linux.kernel.samsung-soc/29085 We have tested these patches on SMDK5250 board for System boot and Arndale (Exynos5250) board for System boot and PMU initialization and S2R. For testing on Arndale (Exynos5250) board: Tested-by: Pankaj Dubey Changes Since v2: - Rebased on top of Daniel Lezcano's Exynos cpuidle refactor patches. - Removed exynos_cpuidle_init and exynos_cpufreq_init code as suggested by Tomasz Figa. - Removed early mapping of PMU base address from exynos.c and removed "get_exynos_pmuaddr" function. Instead of this added code in platsmp.c to get PMU base address using of_iomap as suggested by Tomasz Figa. - Converted PMU implementation into platform_driver by using static platform_device method. Changes Since v1: - Rebased on latest for-next of Kukjin Kim's tree. - Added patch: "Make exynos machine_ops as static". For making more cleanup in "mach-exynos/common.h" as suggested by Tomasz Figa. - Addressed comments of Tomasz Figa for cleaning "mach-exynos/common.h". - Updated patch: Remove file path from comment section As suggested by Michel Simek, instead of updating file path lets remove them from each file under "mach-exynos". Even though Kukjin pointed out that there is similar patch pending from Sachin/Tushar but since I could not find I have included this here. If I have missed something please point to any existing such patch. - Updated patch: Add support for mapping PMU base address via DT - Removed __initdata from declaration of "exynos_pmu_base", as it caused kernel crash as pointed out by Vikas Sajjan. - Added support for Syscon initialization and getting PMU regmap handle as suggested by Sylwester. Since current implementation of early intialization [1] has limitation that "early_syscon_init" requires DT to be unflattened and system should be able to allocate memory, we can't use regmap handles for platsmp.c file as "smp_secondary_init" will be called before DT unflattening. So I have kept both method for accessing PMU base address. platsmp.c will use ioremmaped address where as rest other files can use regmap handle. - Added patch: Remove "linux/bug.h" from pmu.c. - Updated patch: Refactored code for PMU register mapping via DT - Modified to use regmap_read/write when using regmap handle. - Added patch: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c - Added patch: Add device tree based initialization support for PMU. - Convert existing PMU implementation to be a device tree based before moving it to "drivers/mfd" folder. As suggested by Bartlomiej. - Dropped making a platform_driver for PMU, as currently PMU binding has two compatibility strings as "samsung, exynosxxx-pmu", "syscon", once we enable MFD_SYSCON config option, current "syscon" driver probe gets called and PMU probe never gets called. So modified PMU initialization code to scan DT and match against supported compatiblity string in driver code, and once we get matching node use that for accessing PMU regmap handle using "syscon_early_regmap_lookup_by_phandle". If there is any better solution please suggest. Pankaj Dubey (8): ARM: EXYNOS: Make exynos machine_ops as static ARM: EXYNOS: Move cpufreq and cpuidle device registration to init_machine ARM: EXYNOS: Cleanup "mach-exynos/common.h" file ARM: EXYNOS: Remove file path from comment section ARM: EXYNOS: Remove "linux/bug.h" from pmu.c ARM: EXYNOS: Refactored code for using PMU address via DT ARM: EXYNOS: Move "mach/map.h" inclusion from regs-pmu.h to platsmp.c ARM: EXYNOS: Add platform driver support for Exynos PMU. Young-Gun Jang (4): ARM: EXYNOS: Move SYSREG definition into sys-reg specific file. ARM: EXYNOS: Remove regs-pmu.h header dependency from pm_domain ARM: EXYNOS: Add support for mapping PMU base address via DT ARM: EXYNOS: Move PMU specific definitions
[PATCH v3 05/12] ARM: EXYNOS: Remove file path from comment section
Many files under "arm/mach-exynos" are having file path in file comment section which is invalid now. So for better code maintainability let's remove them. Signed-off-by: Pankaj Dubey Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/headsmp.S |2 -- arch/arm/mach-exynos/hotplug.c |3 +-- arch/arm/mach-exynos/include/mach/memory.h |3 +-- arch/arm/mach-exynos/platsmp.c |3 +-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S index cdd9d91..698c57f 100644 --- a/arch/arm/mach-exynos/headsmp.S +++ b/arch/arm/mach-exynos/headsmp.S @@ -1,6 +1,4 @@ /* - * linux/arch/arm/mach-exynos4/headsmp.S - * * Cloned from linux/arch/arm/mach-realview/headsmp.S * * Copyright (c) 2003 ARM Limited diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 5eead53..73b0b5c 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -1,5 +1,4 @@ -/* linux arch/arm/mach-exynos4/hotplug.c - * +/* * Cloned from linux/arch/arm/mach-realview/hotplug.c * * Copyright (C) 2002 ARM Ltd. diff --git a/arch/arm/mach-exynos/include/mach/memory.h b/arch/arm/mach-exynos/include/mach/memory.h index 2a4cdb7..e19df1f 100644 --- a/arch/arm/mach-exynos/include/mach/memory.h +++ b/arch/arm/mach-exynos/include/mach/memory.h @@ -1,5 +1,4 @@ -/* linux/arch/arm/mach-exynos4/include/mach/memory.h - * +/* * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. * http://www.samsung.com * diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 03e5e9f..29c2286 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -1,5 +1,4 @@ -/* linux/arch/arm/mach-exynos4/platsmp.c - * +/* * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. * http://www.samsung.com * -- 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 v3 02/12] ARM: EXYNOS: Move cpufreq and cpuidle device registration to init_machine
As exynos_cpuidle_init and exynos_cpufreq_init function have just one lines of code for registering platform devices. We can move these lines to exynos_dt_machine_init and delete exynos_cpuidle_init and exynos_cpufreq_init function. This will help in reducing lines of code in exynos.c, making it more cleaner. Suggested-by: Tomasz Figa Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/exynos.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 06dcce5..9315bd8 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -226,19 +226,6 @@ static struct platform_device exynos_cpuidle = { .id= -1, }; -void __init exynos_cpuidle_init(void) -{ - if (soc_is_exynos5440()) - return; - - platform_device_register(_cpuidle); -} - -void __init exynos_cpufreq_init(void) -{ - platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); -} - static void __init exynos_init_late(void) { if (of_machine_is_compatible("samsung,exynos5440")) @@ -367,8 +354,10 @@ static void __init exynos_dt_machine_init(void) } } - exynos_cpuidle_init(); - exynos_cpufreq_init(); + if (!soc_is_exynos5440()) + platform_device_register(_cpuidle); + + platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } -- 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 v3 11/12] ARM: EXYNOS: Add platform driver support for Exynos PMU.
This patch modifies Exynos Power Management Unit (PMU) initialization implementation in following way: - Added platform_device support by registering static platform device. - Added platform struct exynos_pmu_data to hold platform specific data. - For each SoC's PMU support now we can add platform data and statically bind PMU configuration and SoC specific initialization function. - Probe function will scan DT and based on matching PMU compatibility string initialize pmu_context which will be platform_data for driver. - Obtain PMU regmap handle using "syscon_regmap_lookup_by_phandle" so that we can reduce dependency over machine header files. - Separate each SoC's PMU initialization function and make it as part of platform data. - It also removes uses of soc_is_exynos() thus making PMU implementation independent of "plat/cpu.h". Signed-off-by: Pankaj Dubey Signed-off-by: Young-Gun Jang --- arch/arm/mach-exynos/pmu.c | 280 +++- 1 file changed, 224 insertions(+), 56 deletions(-) diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 67116a5..030df96 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. + * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd. * http://www.samsung.com/ * * EXYNOS - CPU PMU(Power Management Unit) support @@ -9,20 +9,33 @@ * published by the Free Software Foundation. */ -#include -#include +#include #include - -#include +#include +#include +#include +#include #include "common.h" #include "regs-pmu.h" -static const struct exynos_pmu_conf *exynos_pmu_config; -static struct regmap *pmu_regmap; +struct exynos_pmu_data { + const struct exynos_pmu_conf *pmu_config; + const struct exynos_pmu_conf *pmu_config_extra; + void (*pmu_init)(void); + void (*powerdown_conf)(enum sys_powerdown); +}; + +struct exynos_pmu_context { + struct device *dev; + struct exynos_pmu_data *pmu_data; + struct regmap *pmu_regmap; +}; + +static struct exynos_pmu_context *pmu_context; static const struct exynos_pmu_conf exynos4210_pmu_config[] = { - /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ + /* { .offset = address, .val = { AFTR, LPA, SLEEP } */ { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, { S5P_DIS_IRQ_CORE0,{ 0x0, 0x0, 0x0 } }, { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, @@ -216,7 +229,7 @@ static const struct exynos_pmu_conf exynos4412_pmu_config[] = { }; static const struct exynos_pmu_conf exynos5250_pmu_config[] = { - /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ + /* { .offset = address, .val = { AFTR, LPA, SLEEP } */ { EXYNOS5_ARM_CORE0_SYS_PWR_REG,{ 0x0, 0x0, 0x2} }, { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG,{ 0x0, 0x0, 0x0} }, @@ -339,7 +352,7 @@ static unsigned int const exynos5_list_diable_wfi_wfe[] = { EXYNOS5_ISP_ARM_OPTION, }; -static void exynos5_init_pmu(void) +void exynos5_powerdown_conf(enum sys_powerdown mode) { unsigned int i; unsigned int tmp; @@ -348,81 +361,236 @@ static void exynos5_init_pmu(void) * Enable both SC_FEEDBACK and SC_COUNTER */ for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) { - regmap_read(pmu_regmap, exynos5_list_both_cnt_feed[i], ); + regmap_read(pmu_context->pmu_regmap, + exynos5_list_both_cnt_feed[i], ); tmp |= (EXYNOS5_USE_SC_FEEDBACK | EXYNOS5_USE_SC_COUNTER); - regmap_write(pmu_regmap, exynos5_list_both_cnt_feed[i], tmp); + regmap_write(pmu_context->pmu_regmap, + exynos5_list_both_cnt_feed[i], tmp); } /* * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable */ - regmap_read(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, ); + regmap_read(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, ); tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN; - regmap_write(pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp); + regmap_write(pmu_context->pmu_regmap, EXYNOS5_ARM_COMMON_OPTION, tmp); /* * Disable WFI/WFE on XXX_OPTION */ for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) { - tmp = regmap_read(pmu_regmap, exynos5_list_diable_wfi_wfe[i], - ); + tmp = regmap_read(pmu_context->pmu_regmap, + exynos5_list_diable_wfi_wfe[i], ); tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE | EXYNOS5_OPTION_USE_STANDBYWFI); -
[PATCH v3 03/12] ARM: EXYNOS: Cleanup "mach-exynos/common.h" file
Remove unused and unwanted declarations from "mach-exynos/common.h" Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h |9 - 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 30123a0..8a4aa0b 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -15,15 +15,6 @@ #include #include -void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); - -struct map_desc; -void exynos_init_io(void); -void exynos_restart(enum reboot_mode mode, const char *cmd); -void exynos_cpuidle_init(void); -void exynos_cpufreq_init(void); -void exynos_init_late(void); - void exynos_firmware_init(void); #ifdef CONFIG_PINCTRL_EXYNOS -- 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 v3 08/12] ARM: EXYNOS: Remove "linux/bug.h" from pmu.c
This patch removes unnecessary header file inclusion from pmu.c. Signed-off-by: Young-Gun Jang Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/pmu.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 05c7ce1..4c3453a 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -11,7 +11,6 @@ #include #include -#include #include -- 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 v3 12/12] ARM: EXYNOS: Move PMU specific definitions from common.h
From: Young-Gun Jang This patch moves PMU specific definitions into a new file as exynos-pmu.h. This will help in making PMU implementation independent of common.h header. Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h | 17 - arch/arm/mach-exynos/exynos-pmu.h | 31 +++ arch/arm/mach-exynos/pm.c |1 + arch/arm/mach-exynos/pmu.c|2 +- 4 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-exynos/exynos-pmu.h diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 2922f20..8f45a35 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -35,24 +35,7 @@ extern struct smp_operations exynos_smp_ops; extern void exynos_cpu_die(unsigned int cpu); -/* PMU(Power Management Unit) support */ - -#define PMU_TABLE_END (-1U) - -enum sys_powerdown { - SYS_AFTR, - SYS_LPA, - SYS_SLEEP, - NUM_SYS_POWERDOWN, -}; - extern unsigned long l2x0_regs_phys; -struct exynos_pmu_conf { - unsigned int offset; - unsigned int val[NUM_SYS_POWERDOWN]; -}; - -extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); extern void exynos_enter_aftr(void); extern struct regmap *get_exynos_pmuregmap(void); diff --git a/arch/arm/mach-exynos/exynos-pmu.h b/arch/arm/mach-exynos/exynos-pmu.h new file mode 100644 index 000..16ff036 --- /dev/null +++ b/arch/arm/mach-exynos/exynos-pmu.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Header for EXYNOS PMU Driver support + * + * 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. + */ + +#ifndef __EXYNOS_PMU_H +#define __EXYNOS_PMU_H + +#define PMU_TABLE_END (-1U) + +enum sys_powerdown { + SYS_AFTR, + SYS_LPA, + SYS_SLEEP, + NUM_SYS_POWERDOWN, +}; + +struct exynos_pmu_conf { + unsigned int offset; + unsigned int val[NUM_SYS_POWERDOWN]; +}; + +extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); + +#endif /* __EXYNOS_PMU_H */ diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index ee427d7..a7a1b7f 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -38,6 +38,7 @@ #include "common.h" #include "regs-pmu.h" #include "regs-sys.h" +#include "exynos-pmu.h" static struct regmap *pmu_regmap; diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 030df96..1570761 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -16,7 +16,7 @@ #include #include -#include "common.h" +#include "exynos-pmu.h" #include "regs-pmu.h" struct exynos_pmu_data { -- 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 v3 04/12] ARM: EXYNOS: Move SYSREG definition into sys-reg specific file.
From: Young-Gun Jang While making PMU implementation to be device tree based, there are few register offsets related with SYSREG present in regs-pmu.h, so let's make a new header file "regs-sys.h" to keep all such SYSREG related register offsets and remove them from "regs-pmu.h" Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/exynos.c |1 + arch/arm/mach-exynos/pm.c |1 + arch/arm/mach-exynos/regs-pmu.h |3 --- arch/arm/mach-exynos/regs-sys.h | 22 ++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 arch/arm/mach-exynos/regs-sys.h diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 9315bd8..a7b45db 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -31,6 +31,7 @@ #include "common.h" #include "mfc.h" #include "regs-pmu.h" +#include "regs-sys.h" #define L2_AUX_VAL 0x7C470001 #define L2_AUX_MASK 0xC200 diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index b380d48..f445c49 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -36,6 +36,7 @@ #include "common.h" #include "regs-pmu.h" +#include "regs-sys.h" /** * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 6c1d2db..b68b5cc 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -15,7 +15,6 @@ #include #define S5P_PMUREG(x) (S5P_VA_PMU + (x)) -#define S5P_SYSREG(x) (S3C_VA_SYS + (x)) #define S5P_CENTRAL_SEQ_CONFIGURATION S5P_PMUREG(0x0200) @@ -178,8 +177,6 @@ /* For EXYNOS5 */ -#define EXYNOS5_SYS_I2C_CFG S5P_SYSREG(0x0234) - #define EXYNOS5_AUTO_WDTRESET_DISABLE S5P_PMUREG(0x0408) #define EXYNOS5_MASK_WDTRESET_REQUEST S5P_PMUREG(0x040C) diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h new file mode 100644 index 000..84332b0 --- /dev/null +++ b/arch/arm/mach-exynos/regs-sys.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * EXYNOS - system register definition + * + * 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. +*/ + +#ifndef __ASM_ARCH_REGS_SYS_H +#define __ASM_ARCH_REGS_SYS_H __FILE__ + +#include + +#define S5P_SYSREG(x) (S3C_VA_SYS + (x)) + +/* For EXYNOS5 */ +#define EXYNOS5_SYS_I2C_CFGS5P_SYSREG(0x0234) + +#endif /* __ASM_ARCH_REGS_SYS_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 v3 01/12] ARM: EXYNOS: Make exynos machine_ops as static
As machine function ops are used only in this file let's make them static. Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/exynos.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 3d69e8d..06dcce5 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -198,7 +198,7 @@ static struct map_desc exynos5_iodesc[] __initdata = { }, }; -void exynos_restart(enum reboot_mode mode, const char *cmd) +static void exynos_restart(enum reboot_mode mode, const char *cmd) { struct device_node *np; u32 val = 0x1; @@ -239,7 +239,7 @@ void __init exynos_cpufreq_init(void) platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); } -void __init exynos_init_late(void) +static void __init exynos_init_late(void) { if (of_machine_is_compatible("samsung,exynos5440")) /* to be supported later */ @@ -300,7 +300,7 @@ static void __init exynos_map_io(void) iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); } -void __init exynos_init_io(void) +static void __init exynos_init_io(void) { debug_ll_io_init(); -- 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 5/7] x86: Make old K8 swapgs workaround conditional
On 04/28/2014 03:12 PM, Andi Kleen wrote: > From: Andi Kleen > > Every gs selector/index reload always paid an extra MFENCE > between the two SWAPGS. This was to work around an old > bug in early K8 steppings. All other CPUs don't need the extra > mfence. Patch the extra MFENCE only in for K8. > > Signed-off-by: Andi Kleen > --- > arch/x86/include/asm/cpufeature.h | 1 + > arch/x86/kernel/cpu/amd.c | 3 +++ > arch/x86/kernel/entry_64.S| 10 +- > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/cpufeature.h > b/arch/x86/include/asm/cpufeature.h > index 89270b4..eb4bb46 100644 > --- a/arch/x86/include/asm/cpufeature.h > +++ b/arch/x86/include/asm/cpufeature.h > @@ -102,6 +102,7 @@ > #define X86_FEATURE_APERFMPERF (3*32+28) /* APERFMPERF */ > #define X86_FEATURE_EAGER_FPU(3*32+29) /* "eagerfpu" Non lazy FPU > restore */ > #define X86_FEATURE_NONSTOP_TSC_S3 (3*32+30) /* TSC doesn't stop in S3 state > */ > +#define X86_FEATURE_SWAPGS_MFENCE (3*32+31) /* SWAPGS may need MFENCE */ > Nitpick: should be an X86_BUG_ instead. -hpa -- 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 4/7] x86: Add support for rd/wr fs/gs base
On 04/29/2014 09:52 PM, H. Peter Anvin wrote: > > It matters -- greatly -- if (and only if) we can enter the kernel with > usergs == kernelgs and then want to change usergs inside a paranoid > routine. At that point we risk being upside down, which basically means > we're rooted. > > However, I believe this patchset also means only IST entries can be > paranoid, which in turn means we can't sleep inside them. To the very > best of my knowledge the only times we change usergs is on context > switch or inside a system call. We need to make sure that is actually > the case, though. > > I'm at ELC for a few days, so I'll have limited decent-sized-monitor > time, but it shouldn't be too hard to convince ourselves of... mostly a > matter of making sure something like ptrace can't to stupid crap. > Just in case anyone is getting the wrong impression: this is a discussion about details. I'm glad to see this work getting done. -hpa -- 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] powerpc 32: Provides VIRT_CPU_ACCOUNTING
On Wed, 2014-03-19 at 17:05 -0500, Scott Wood wrote: > On Wed, 2014-03-19 at 22:52 +0100, Christophe Leroy wrote: > > This patch provides VIRT_CPU_ACCOUTING to PPC32 architecture. > > Unlike PPC64, PPC32 doesn't provide the PACA register. Therefore the > > implementation is similar to the one done in the IA64 architecture. > > It is based on additional information added to the Task Info structure. > > PACA isn't a register -- just a convention for how Linux uses a GPR. > Maybe it's time to use it on PPC32 as well? PACA is actually a data structure and you really really don't want it on ppc32 :-) Having a register point to current works, having a register point to per-cpu data instead works too (ie, change what we do today), but don't introduce a PACA *please* :-) > > > Index: b/arch/powerpc/kernel/asm-offsets.c > > === > > --- b/arch/powerpc/kernel/asm-offsets.c (revision 5607) > > +++ b/arch/powerpc/kernel/asm-offsets.c (revision 5608) > > @@ -167,6 +167,10 @@ > > DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); > > DEFINE(TI_TASK, offsetof(struct thread_info, task)); > > DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); > > + DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp)); > > + DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave)); > > + DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime)); > > + DEFINE(TI_AC_UTIME, offsetof(struct thread_info, ac_utime)); > > Doesn't this need to be protected by #ifdef > CONFIG_VIRT_CPU_ACCOUNTING_NATIVE? > > > > > #ifdef CONFIG_PPC64 > > DEFINE(DCACHEL1LINESIZE, offsetof(struct ppc64_caches, dline_size)); > > Index: b/arch/powerpc/include/asm/thread_info.h > > === > > --- b/arch/powerpc/include/asm/thread_info.h(revision 5607) > > +++ b/arch/powerpc/include/asm/thread_info.h(revision 5608) > > @@ -43,6 +43,12 @@ > > int cpu;/* cpu we're on */ > > int preempt_count; /* 0 => preemptable, > ><0 => BUG */ > > +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > > + __u32 ac_stamp; > > + __u32 ac_leave; > > + __u32 ac_stime; > > + __u32 ac_utime; > > +#endif > > This isn't uapi; why not use "u32"? > > Plus, it should be made clear that this is only used on 32-bit. > > > struct restart_block restart_block; > > unsigned long local_flags;/* private flags for thread */ > > > > @@ -58,6 +64,8 @@ > > .task = , \ > > .exec_domain = _exec_domain, \ > > .cpu = 0, \ > > + .ac_stime = 0, \ > > + .ac_utime = 0, \ > > Also needs to be ifdeffed -- which isn't going to work in a macro, so > maybe remove the ifdef from the variable declarations, or just let the > fields be initialized to zero by default. Or add PACA to 32-bit. :-) > > -Scott > -- 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 4/7] x86: Add support for rd/wr fs/gs base
On 04/29/2014 04:39 PM, Andi Kleen wrote: >> Case 3 is annoying. If nothing tries to change the user gs base, then >> everything is okay because the user gs base and the kernel gs bases are >> equal. But if something does try to change the user gs base, then it >> will accidentally change the kernel gs base instead. > > It doesn't really matter, as they are the same. > They would just switch identities. > > Besides I don't think anyone does that. > It matters -- greatly -- if (and only if) we can enter the kernel with usergs == kernelgs and then want to change usergs inside a paranoid routine. At that point we risk being upside down, which basically means we're rooted. However, I believe this patchset also means only IST entries can be paranoid, which in turn means we can't sleep inside them. To the very best of my knowledge the only times we change usergs is on context switch or inside a system call. We need to make sure that is actually the case, though. I'm at ELC for a few days, so I'll have limited decent-sized-monitor time, but it shouldn't be too hard to convince ourselves of... mostly a matter of making sure something like ptrace can't to stupid crap. -hpa -- 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] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
On 04/29/2014 08:44 PM, Hui Zhu wrote: > > I am sorry that the root cause of issue has something wrong. > The right root cause is: > When inferior call 32 bits syscall "read", Linux kernel function > "ia32_cstar_target" will set TS_COMPAT to current_thread_info->status. > > syscall read is interrupt by ctrl-c. Then the $rax will be set to > errno -512 in 64 bits. > And the inferior will be stopped by Linux kernel function ptrace_stop, > the call trace is: > #0 freezable_schedule () at include/linux/freezer.h:172 > #1 ptrace_stop (exit_code=exit_code@entry=5, why=why@entry=262148, > clear_code=clear_code@entry=0, info=info@entry=0x88001d833e78) > at kernel/signal.c:1920 > #2 0x8107ec33 in ptrace_signal (info=0x88001d833e78, signr=5) > at kernel/signal.c:2157 > #3 get_signal_to_deliver (info=info@entry=0x88001d833e78, > return_ka=return_ka@entry=0x88001d833e58, regs=, > cookie=cookie@entry=0x0 ) at kernel/signal.c:2269 > #4 0x81013438 in do_signal (regs=regs@entry=0x88001d833f58) > at arch/x86/kernel/signal.c:696 > #5 0x81013a40 in do_notify_resume (regs=0x88001d833f58, > unused=, thread_info_flags=4) at > arch/x86/kernel/signal.c:747 > #6 > #7 0x in irq_stack_union () > > After that, GDB can control the stopped inferior. > To call function "func1()" of inferior, GDB need: > Step 1, save current values of registers ($rax 0xfe00(64 bits > -512) > is cut to 0xfe00(32 bits -512) because inferior is a 32 bits program). So gdb just corrupted the system state. > Step 2, change the values of registers. > Step 3, Push a dummy frame to stack. > Step 4, set a breakpint in the return address. > > When GDB resume the inferior, it will keep execut from ptrace_stop > with new values of registers that set by GDB. > And TS_COMPAT inside current_thread_info->status will be cleared when > inferior switch back to user space. As it should, because TS_COMPAT *only is meaningful while a system call is executing*. > When function "func1()" return, inferior will be stoped by breakpoint > inferior will be stopped by Linux kernel function "ptrace_stop" again. > current_thread_info->status will not set TS_COMPAT when inferior swith > from user space to kernel space because breakpoint handler "int3" doesn't > has code for that. As it shouldn't, because there is no system call entry involved. > GDB begin to set saved values of registers back to inferior that use > function "amd64_collect_native_gregset". Because this function just > zero-extend each 32 bits value to 64 bits value before put them to inferior. > $rax's value is set to 0xfe00(32 bits -512) but not > 0xfe00(64 bits -512). > > When GDB continue syscall "read" that is interrupted by "ctrl-c", it will > keep execute from ptrace_stop without "TS_COMPAT". gdb has corrupted the state, and it fails to execute. I'm wondering if we need to add additional state here, to carry the TS_COMPAT bit. We have talked about this kind of issues in the past. > Then in Linux kernel function "syscall_get_error", current_thread_info->status > doesn't have TS_COMPAT and $rax is 0xfe00(32 bits -512). Then in > function do_signal will not handle this -ERESTARTSYS. > > -ERESTARTSYS will be return back to inferior, that is why inferior got a > errno -ERESTARTSYS. > > I made a new patch that before call do_notify_resume(will call do_signal) > in the int3 handler, set TS_COMPAT to status if this task is TIF_IA32. > Then after GDB call a function of inferior, it will still has TS_COMPAT. I'm not sure if I want to label this a gdb bug or not (my main feeling is that gdb should save and restore the register set presented to it, and that truncating values to 32 bits is the root of the problem), but the above is definitely a hack which doesn't really address the real problem. -hpa -- 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 v12 00/31] iommu/exynos: Fixes and Enhancements of System MMU driver with DT
On Mon, Apr 28, 2014 at 2:04 PM, Arnd Bergmann wrote: > On Sunday 27 April 2014 13:07:32 Shaik Ameer Basha wrote: >> The current exynos-iommu(System MMU) driver does not work autonomously >> since it is lack of support for power management of peripheral blocks. >> For example, MFC device driver must ensure that its System MMU is disabled >> before MFC block is power-down not to invalidate IOTLB in the System MMU >> when I/O memory mapping is changed. Because a System MMU resides in the >> same H/W block, access to control registers of System MMU while the H/W >> block is turned off must be prohibited. >> >> This set of changes solves the above problem with setting each System MMUs >> as the parent of the device which owns the System MMU to receive the >> information when the device is turned off or turned on. >> >> Another big change to the driver is the support for devicetree. >> The bindings for System MMU is described in >> Documentation/devicetree/bindings/arm/samsung/system-mmu.txt > > Sorry I've been absent from the review so far. Most of the patches > seem entirely reasonable to me, but I'm worried about the DT binding > aspect. We are going to see more systems shipping with IOMMUs now, > and we are seeing an increasing number of submissions for 64-bit > systems. We really have to work out what the DT representation for > IOMMUs should look like in general before adding another ad-hod > implementation that is private to one driver. Hi Arnd, No issues. Its good that finally you are here :) I am going through the possibilities for new bindings that you mentioned in the other thread. -- [PATCH v12 11/31] documentation: iommu: add binding document of Exynos System MMU Exynos IOMMU driver is pretty simple with only one exception, "some devices are using multiple IOMMUs". >From starting (of this patch set), we were trying to fix three major issues. [1] How to control the probing order of required IOMMU(s) for a given device and a device itself. [2] Handling multiple IOMMUs for one device. [3] Generic DT bindings to link Device and IOMMUs. I have gone through the implementation of Tegra SMMU driver by "Hiroshi Doyu" -- [PATCHv7 00/12] Unifying SMMU driver among Tegra SoCs [https://lkml.org/lkml/2013/12/12/74] For the first point [1], -- Tegra implementation tries to fix this issue with these two patches -- iommu/of: check if dependee iommu is ready or not [http://patchwork.ozlabs.org/patch/300560/] -- driver/core: populate devices in order for IOMMUs [http://patchwork.ozlabs.org/patch/300558/] I can follow this driver if this approach is acceptable. For the second point [2] -- Currently we are handling this issue by providing same mapping for all IOMMUs linked to the same device. And current Exynos drivers doesn't have any special implementation to handle this case differently. I thought of understanding how Tegra SMMU driver is handling this case. Frankly speaking, I didn't understand how its done there. For the third point [3] --- As Tegra SMMU driver is inline with the discussion in other thread, we can follow the same bindings, unless the discussion takes us in the other direction. "KyongHo Cho" is the author for this driver and hope he has more inputs. Regards, Shaik > > Arnd > -- > To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" > in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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: [Bugfix v2] sched: fix possible invalid memory access caused by CPU hot-addition
Thanks Peter, I will try to find other solutions. On 2014/4/28 15:09, Peter Zijlstra wrote: > On Mon, Apr 28, 2014 at 10:48:13AM +0800, Jiang Liu wrote: >> Intel platforms with Nehalem/Westmere/IvyBridge CPUs may support socket >> hotplug/online at runtime. The CPU hot-addition flow is: >> 1) handle CPU hot-addition event >> 1.a) gather platform specific information >> 1.b) associate hot-added CPU with NUMA node >> 1.c) create CPU device >> 2) online hot-added CPU through sysfs: >> 2.a)cpu_up() >> 2.b)->try_online_node() >> 2.c)->hotadd_new_pgdat() >> 2.d)->node_set_online() >> >> Between 1.b and 2.c, hot-added CPUs are associated with NUMA nodes >> but those NUMA nodes may still be in offlined state. So we should >> check node_online(nid) before calling kmalloc_node(nid) and friends, >> otherwise it may cause invalid memory access as below. > > So complete and full NAK on this. This is a workaround for a fucked in > the head BIOS. If you're going to do a work around for that they should > live in arch/ space, not in core code. > > The code in question is nearly 7 years old (2.6.24), which leads me to > believe it works just fine for (regular) memory less nodes as I've not > had complaints about it before. > -- > 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/ > -- 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 v3 3/4] usb: ohci-exynos: Add facility to use phy provided by the generic phy framework
Hi, On Mon, Apr 28, 2014 at 9:11 PM, Alan Stern wrote: > On Mon, 28 Apr 2014, Vivek Gautam wrote: > >> Add support to consume phy provided by Generic phy framework. >> Keeping the support for older usb-phy intact right now, in order >> to prevent any functionality break in absence of relevant >> device tree side change for ohci-exynos. >> Once we move to new phy in the device nodes for ohci, we can >> remove the support for older phys. >> >> Signed-off-by: Vivek Gautam >> Cc: Jingoo Han >> Cc: Alan Stern >> --- > >> +static int exynos_ohci_phy_enable(struct device *dev) >> { >> struct usb_hcd *hcd = dev_get_drvdata(dev); >> struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); >> + int i; >> + int ret = 0; >> >> - if (exynos_ohci->phy) >> - usb_phy_init(exynos_ohci->phy); >> + if (exynos_ohci->phy) { >> + ret = usb_phy_init(exynos_ohci->phy); >> + if (ret) >> + return ret; >> + } >> + >> + for (i = 0; ret == 0 && i < PHY_NUMBER; i++) >> + if (exynos_ohci->phy_g[i]) >> + ret = phy_power_on(exynos_ohci->phy_g[i]); >> + if (ret) >> + for (i--; i >= 0; i--) >> + if (exynos_ohci->phy_g[i]) >> + phy_power_off(exynos_ohci->phy_g[i]); > > Do you want to call usb_phy_shutdown() at this point? Yes, you are right. We should be calling usb_phy_shutdown() here. But the two phy-provider drivers should never work together, so one of the above PHYs will not exist. Anyways, for code correctness too, we should be doing as you suggested. I will change this. > >> + >> + return ret; >> } >> >> -static void exynos_ohci_phy_disable(struct device *dev) >> +static int exynos_ohci_phy_disable(struct device *dev) >> { >> struct usb_hcd *hcd = dev_get_drvdata(dev); >> struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); >> + int i; >> + int ret = 0; >> >> if (exynos_ohci->phy) >> usb_phy_shutdown(exynos_ohci->phy); >> + >> + for (i = 0; i < PHY_NUMBER; i++) >> + if (exynos_ohci->phy_g[i]) >> + ret = phy_power_off(exynos_ohci->phy_g[i]); >> + >> + return ret; >> } > > This return value is practically meaningless. It is the status from > the last PHY only; any errors involving the other PHYs have been lost. > > You may as well make this function return void. Right, i will make this function return void and remove 'ret' from it. > >> @@ -210,13 +302,18 @@ static int exynos_ohci_resume(struct device *dev) >> { >> struct usb_hcd *hcd = dev_get_drvdata(dev); >> struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); >> + int ret; >> >> clk_prepare_enable(exynos_ohci->clk); >> >> if (exynos_ohci->otg) >> exynos_ohci->otg->set_host(exynos_ohci->otg, >self); >> >> - exynos_ohci_phy_enable(dev); >> + ret = exynos_ohci_phy_enable(dev); >> + if (ret) { >> + dev_err(dev, "Failed to enable USB phy\n"); > > Do you want to call clk_disable_unprepare() here? Yes, we should be calling clk_disable_unprepate() here to avoid the warning in the next suspend cycle. -- Best Regards Vivek Gautam Samsung R Institute, Bangalore India -- 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] cpufreq: intel_pstate: Remove sample parameter in intel_pstate_calc_busy
On 29 April 2014 23:23, Stratos Karafotis wrote: > Since commit d37e2b7644 ("intel_pstate: remove unneeded sample buffers") > we use only one sample. So, there is no need to pass the sample > pointer to intel_pstate_calc_busy. Instead, get the pointer from > cpudata. Also, remove the unused SAMPLE_COUNT macro. > > While at it, reformat the first line in this function. > > Signed-off-by: Stratos Karafotis > --- > drivers/cpufreq/intel_pstate.c | 11 --- > 1 file changed, 4 insertions(+), 7 deletions(-) Acked-by: Viresh Kumar -- 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] cpufreq: powernow-k8: Fix checkpatch warnings
On 30 April 2014 04:09, Rafael J. Wysocki wrote: > It should be cleaned up generally, so if you have the time and you're willing > to do such things, please do them. > > That said things like lines in excess of 80 characters may stay as they are. I have tried this sort of stuff earlier, but there is one issue that stands up again and again. When you update neighboring lines of lines crossing 80 columns, we do get warnings for lines which aren't actually updated by us (from checkpatch.pl). So, probably we need to fix checkpatch then.. -- 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: dcache shrink list corruption?
On Tue, Apr 29, 2014 at 07:56:13PM -0700, Linus Torvalds wrote: > On Tue, Apr 29, 2014 at 7:31 PM, Al Viro wrote: > > > > OK, aggregate diff follows, more readable splitup (3 commits) attached. > > It seems to survive beating here; testing, review and comments are > > welcome. > > Miklos, did you have some particular load that triggered this, or was > it just some reports? It would be really good to get this patch some > stress-testing. > > I like how the patch removes more lines than it adds, but apart from > that it's hard to read the patch (even the split-out ones) and say > anything more about it. I think this needs a *lot* of testing. FWIW, the first two are really straightforward expanding the function into its only callsite. The last needs more splitup. Not sure if the following is good enough, but it ought to be at least somewhat cleaner. Combined change is identical to the original, so it doesn't invalidate the testing so far... >From 895aeb48465bbf78803fd11dee2556d010ada23a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 29 Apr 2014 15:45:28 -0400 Subject: [PATCH 1/6] fold d_kill() and d_free() Signed-off-by: Al Viro --- fs/dcache.c | 76 +++ 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 494a9def..9b15c5c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -246,23 +246,6 @@ static void __d_free(struct rcu_head *head) kmem_cache_free(dentry_cache, dentry); } -/* - * no locks, please. - */ -static void d_free(struct dentry *dentry) -{ - BUG_ON((int)dentry->d_lockref.count > 0); - this_cpu_dec(nr_dentry); - if (dentry->d_op && dentry->d_op->d_release) - dentry->d_op->d_release(dentry); - - /* if dentry was never visible to RCU, immediate free is OK */ - if (!(dentry->d_flags & DCACHE_RCUACCESS)) - __d_free(>d_u.d_rcu); - else - call_rcu(>d_u.d_rcu, __d_free); -} - /** * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups * @dentry: the target dentry @@ -420,40 +403,6 @@ static void dentry_lru_del(struct dentry *dentry) } /** - * d_kill - kill dentry and return parent - * @dentry: dentry to kill - * @parent: parent dentry - * - * The dentry must already be unhashed and removed from the LRU. - * - * If this is the root of the dentry tree, return NULL. - * - * dentry->d_lock and parent->d_lock must be held by caller, and are dropped by - * d_kill. - */ -static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) - __releases(dentry->d_lock) - __releases(parent->d_lock) - __releases(dentry->d_inode->i_lock) -{ - list_del(>d_u.d_child); - /* -* Inform d_walk() that we are no longer attached to the -* dentry tree -*/ - dentry->d_flags |= DCACHE_DENTRY_KILLED; - if (parent) - spin_unlock(>d_lock); - dentry_iput(dentry); - /* -* dentry_iput drops the locks, at which point nobody (except -* transient RCU lookups) can reach this dentry. -*/ - d_free(dentry); - return parent; -} - -/** * d_drop - drop a dentry * @dentry: dentry to drop * @@ -546,7 +495,30 @@ relock: dentry_lru_del(dentry); /* if it was on the hash then remove it */ __d_drop(dentry); - return d_kill(dentry, parent); + list_del(>d_u.d_child); + /* +* Inform d_walk() that we are no longer attached to the +* dentry tree +*/ + dentry->d_flags |= DCACHE_DENTRY_KILLED; + if (parent) + spin_unlock(>d_lock); + dentry_iput(dentry); + /* +* dentry_iput drops the locks, at which point nobody (except +* transient RCU lookups) can reach this dentry. +*/ + BUG_ON((int)dentry->d_lockref.count > 0); + this_cpu_dec(nr_dentry); + if (dentry->d_op && dentry->d_op->d_release) + dentry->d_op->d_release(dentry); + + /* if dentry was never visible to RCU, immediate free is OK */ + if (!(dentry->d_flags & DCACHE_RCUACCESS)) + __d_free(>d_u.d_rcu); + else + call_rcu(>d_u.d_rcu, __d_free); + return parent; } /* -- 1.7.10.4 >From aff934c47717be0216c9e2c10a2e8ca0f829bb54 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 29 Apr 2014 16:13:18 -0400 Subject: [PATCH 2/6] fold try_prune_one_dentry() Signed-off-by: Al Viro --- fs/dcache.c | 75 --- 1 file changed, 25 insertions(+), 50 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 9b15c5c..a5540d4 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -787,47 +787,9 @@ restart: } EXPORT_SYMBOL(d_prune_aliases); -/* - * Try to throw away a dentry - free the inode, dput the parent. - * Requires dentry->d_lock is held, and dentry->d_count == 0. - * Releases dentry->d_lock. - *
Re: Is heap_stack_gap useless?
Resend to kernel-development list. The original email wasn't plaintext mode and was rejected by kernel-development list. On Tue, Apr 29, 2014 at 11:31 PM, Jidong Xiao wrote: > Hi, > > I noticed this variable, defined in mm/nommu.c, > > mm/nommu.c:int heap_stack_gap = 0; > > This variable only shows up once, and never shows up in elsewhere. > > Can some one tell me is this useless? If so, I will submit a patch to remove > it. > > -Jidong -- 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 04/15] ASoC: samsung-idma: avoid 64-bit division
On 04/29/2014 04:48 PM, Xia Kaixu wrote: > From: Arnd Bergmann > > dma_addr_t may be 64 bit wide, which causes a build failure > when doing a division on it. Here it is safe to cast to an > u32 type, which avoids the problem. > > Signed-off-by: Arnd Bergmann > Signed-off-by: Xia Kaixu > Cc: Mark Brown > Cc: Liam Girdwood > Cc: Ben Dooks > Cc: Kukjin Kim > Cc: Sangbeom Kim > Cc: linux-arm-ker...@lists.infradead.org > Cc: linux-samsung-...@vger.kernel.org > Cc: alsa-de...@alsa-project.org > --- Tested with ARM_LPAE enabled. Without this patch, getting following error. sound/built-in.o: In function `iis_irq': sound/soc/samsung/idma.c:277: undefined reference to `__aeabi_uldivmod' Tested-by: Tushar Behera > sound/soc/samsung/idma.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c > index 3d5cf15..e9891b4 100644 > --- a/sound/soc/samsung/idma.c > +++ b/sound/soc/samsung/idma.c > @@ -274,7 +274,7 @@ static irqreturn_t iis_irq(int irqno, void *dev_id) > > addr = readl(idma.regs + I2SLVL0ADDR) - idma.lp_tx_addr; > addr += prtd->periodsz; > - addr %= (prtd->end - prtd->start); > + addr %= (u32)(prtd->end - prtd->start); > addr += idma.lp_tx_addr; > > writel(addr, idma.regs + I2SLVL0ADDR); > -- Tushar Behera -- 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: [3.15-rc3] rtmutex-debug assertion.
On Tue, Apr 29, 2014 at 07:24:30PM -0700, Davidlohr Bueso wrote: > > futex(uaddr=0x7f55ff8c4000, op=0x6, val=0x20006223800b, > > utime=0x7f55ff8c4000, uaddr2=0x7f55ff8c4000, val3=-123) > > Perhaps because of chance. Even for pi futexes, if the lock is > uncontended, the kernel will never take part. Ok, once more.. futex(uaddr=0x25fe000[page_rand], op=0x6, val=0x4e2644b3dfcb, utime=0x25fe004[page_rand], uaddr2=0x25fe008[page_rand], val3=0x440fcd80) FUTEX_LOCK_PI again. > Would reverting commit c365c292d059 (sched: Consider pi boosting in > setscheduler()) fix this? I'll try and write a standalone reproducer in the morning. Then I'll be able to tell you for sure if that commit is good/bad. 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/
Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB
On Tue, Apr 22, 2014 at 12:33 AM, H. Peter Anvin wrote: > On 04/21/2014 09:19 AM, Hui Zhu wrote: >> } >> Now ax is in 32 bits now, need sign-extend to 64 bits. But >> current_thread_info()->status TS_COMPAT is cleared when GDB call "call >> func1()". >> Linux kernel don't know this is a 32 bits task and will not extend it. >> Then -ERESTARTSYS is not be handled and go back to user space. >> >> Then the syscall "read" get a errno in ERESTARTSYS. >> >> To fix this issue, I tried to add a local variable to "do_signal" but >> it is not works. The stack is cleared before GDB "continue". >> so I make a patch that add "test_thread_flag (TIF_IA32)" to >> syscall_get_error. >> >> Signed-off-by: Hui Zhu >> --- >> --- a/arch/x86/include/asm/syscall.h >> +++ b/arch/x86/include/asm/syscall.h >> @@ -48,7 +48,8 @@ static inline long syscall_get_error(str >> * TS_COMPAT is set for 32-bit syscall entries and then >> * remains set until we return to user mode. >> */ >> - if (task_thread_info(task)->status & TS_COMPAT) >> + if ((task_thread_info(task)->status & TS_COMPAT) >> +|| test_thread_flag (TIF_IA32)) >> /* >> * Sign-extend the value so (int)-EFOO becomes (long)-EFOO >> * and will match correctly in comparisons. >> > > No, this is definitely not the right fix. Your description is > incredibly hard to follow, but I feel pretty strongly that the above is > at the very best a last resort fix. TS_COMPAT is a local property > whereas TIF_IA32 is global; it is important to keep their respective > uses correct. Mixing them is almost guaranteed to be just plain wrong. > > -hpa > I am sorry that the root cause of issue has something wrong. The right root cause is: When inferior call 32 bits syscall "read", Linux kernel function "ia32_cstar_target" will set TS_COMPAT to current_thread_info->status. syscall read is interrupt by ctrl-c. Then the $rax will be set to errno -512 in 64 bits. And the inferior will be stopped by Linux kernel function ptrace_stop, the call trace is: #0 freezable_schedule () at include/linux/freezer.h:172 #1 ptrace_stop (exit_code=exit_code@entry=5, why=why@entry=262148, clear_code=clear_code@entry=0, info=info@entry=0x88001d833e78) at kernel/signal.c:1920 #2 0x8107ec33 in ptrace_signal (info=0x88001d833e78, signr=5) at kernel/signal.c:2157 #3 get_signal_to_deliver (info=info@entry=0x88001d833e78, return_ka=return_ka@entry=0x88001d833e58, regs=, cookie=cookie@entry=0x0 ) at kernel/signal.c:2269 #4 0x81013438 in do_signal (regs=regs@entry=0x88001d833f58) at arch/x86/kernel/signal.c:696 #5 0x81013a40 in do_notify_resume (regs=0x88001d833f58, unused=, thread_info_flags=4) at arch/x86/kernel/signal.c:747 #6 #7 0x in irq_stack_union () After that, GDB can control the stopped inferior. To call function "func1()" of inferior, GDB need: Step 1, save current values of registers ($rax 0xfe00(64 bits -512) is cut to 0xfe00(32 bits -512) because inferior is a 32 bits program). Step 2, change the values of registers. Step 3, Push a dummy frame to stack. Step 4, set a breakpint in the return address. When GDB resume the inferior, it will keep execut from ptrace_stop with new values of registers that set by GDB. And TS_COMPAT inside current_thread_info->status will be cleared when inferior switch back to user space. When function "func1()" return, inferior will be stoped by breakpoint inferior will be stopped by Linux kernel function "ptrace_stop" again. current_thread_info->status will not set TS_COMPAT when inferior swith from user space to kernel space because breakpoint handler "int3" doesn't has code for that. GDB begin to set saved values of registers back to inferior that use function "amd64_collect_native_gregset". Because this function just zero-extend each 32 bits value to 64 bits value before put them to inferior. $rax's value is set to 0xfe00(32 bits -512) but not 0xfe00(64 bits -512). When GDB continue syscall "read" that is interrupted by "ctrl-c", it will keep execute from ptrace_stop without "TS_COMPAT". Then in Linux kernel function "syscall_get_error", current_thread_info->status doesn't have TS_COMPAT and $rax is 0xfe00(32 bits -512). Then in function do_signal will not handle this -ERESTARTSYS. -ERESTARTSYS will be return back to inferior, that is why inferior got a errno -ERESTARTSYS. I made a new patch that before call do_notify_resume(will call do_signal) in the int3 handler, set TS_COMPAT to status if this task is TIF_IA32. Then after GDB call a function of inferior, it will still has TS_COMPAT. Signed-off-by: Hui Zhu --- --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -1545,7 +1545,14 @@ paranoid_userspace: ENABLE_INTERRUPTS(CLBR_NONE) xorl %esi,%esi /* arg2: oldset */ movq %rsp,%rdi /* arg1: _regs */ +testl $_TIF_IA32,%ebx +jnz call_do_notify_resume +
Re: [PATCH] mmc: rtsx: usb backend needs LED support
On 04/29/2014 08:46 PM, Arnd Bergmann wrote: On Tuesday 29 April 2014 13:05:15 Ulf Hansson wrote: On 29 April 2014 11:45, Arnd Bergmann wrote: drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_remove': :(.text+0x806480): undefined reference to `led_classdev_unregister' drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_probe': :(.text+0x806708): undefined reference to `led_classdev_register' This adds an explicit dependency in Kconfig I think the proper solution is to fix the dependency in the driver code instead. There are already some ifdefs hackery for making it optional to use leds, apparently that's not working properly. Ah, right, I misinterpreted the bug. Here is a new version: 8<- From 5b5588f8c9b8ded8b296fd32d87b2d118e548a29 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 29 Apr 2014 11:41:40 +0200 Subject: [PATCH] mmc: rtsx: usb backend needs LED support Building the rtsx USB driver uses the LED classdev base support if available, but that fails if the classdev is a module and the MMC driver is built-in, leading to this link error. drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_remove': :(.text+0x806480): undefined reference to `led_classdev_unregister' drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_probe': :(.text+0x806708): undefined reference to `led_classdev_register' This adds an explicit dependency in Kconfig to ensure that the MMC driver has to be a module if LEDS_CLASS is a module, but still allows it to be built-in if LEDS_CLASS is either disabled or built-in. Signed-off-by: Arnd Bergmann diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 92d91fe..68da9b8 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -696,6 +696,7 @@ config MMC_REALTEK_PCI config MMC_REALTEK_USB tristate "Realtek USB SD/MMC Card Interface Driver" depends on MFD_RTSX_USB + depends on m || LEDS_CLASS!=m help Say Y here to include driver code to support SD/MMC card interface of Realtek RTS5129/39 series card reader . I think Ulf's idea is to fix the bug by modifying the .c files. I really found the problem of my ifdef hackery and it should do something similar in sdhci.c as: From: Roger Tseng Date: Wed, 30 Apr 2014 11:11:25 +0800 Subject: [PATCH] mmc: rtsx: fix possible linking error if built-in rtsx_usb_sdmmc module uses the LED classdev if available, but the code failed to consider the situation that it is built-in and the LED classdev is a module, leading to following linking error: LD init/built-in.o drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_remove': rtsx_usb_sdmmc.c:(.text+0x2a018e): undefined reference to `led_classdev_unregister' drivers/built-in.o: In function `rtsx_usb_sdmmc_drv_probe': rtsx_usb_sdmmc.c:(.text+0x2a197e): undefined reference to `led_classdev_register' Fix by excluding such condition when defining macro RTSX_USB_USE_LEDS_CLASS. Signed-off-by: Roger Tseng --- drivers/mmc/host/rtsx_usb_sdmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c index e11fafa..38bdda5 100644 --- a/drivers/mmc/host/rtsx_usb_sdmmc.c +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c @@ -34,7 +34,8 @@ #include #include -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) +#if defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \ + defined(CONFIG_MMC_REALTEK_USB_MODULE)) #include #include #define RTSX_USB_USE_LEDS_CLASS Best regards, Roger Tseng -- 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 18/47] staging/lustre/hsm: HSM requests not delivered
On Apr 29, 2014, at 5:08 AM, Dan Carpenter wrote: > On Sun, Apr 27, 2014 at 01:06:42PM -0400, Oleg Drokin wrote: >> diff --git a/drivers/staging/lustre/lustre/llite/dir.c >> b/drivers/staging/lustre/lustre/llite/dir.c >> index 7fbc18e..c391b60 100644 >> --- a/drivers/staging/lustre/lustre/llite/dir.c >> +++ b/drivers/staging/lustre/lustre/llite/dir.c >> @@ -1804,6 +1804,11 @@ out_rmdir: >> /* Compute the whole struct size */ >> totalsize = hur_len(hur); > hur_len() has an integer overflow bug. Indeed. Thanks. The below check for the MDS_MAXREQSIZE was aimed at fixing it, I guess. But it's obviously flawed. >> OBD_FREE_PTR(hur); >> + >> +/* Final size will be more than double totalsize */ >> +if (totalsize >= MDS_MAXREQSIZE / 3) >> +return -E2BIG; > "totalsize" is signed and this condition doesn't take negatives into > consideration. Make totalsize unsigned. In fact we should just enforce a max limit on item count in hur structure above and that would take care of both the overflow and here. >> + >> OBD_ALLOC_LARGE(hur, totalsize); > How do we know that "totalsize" is more than sizeof(*hur)? If we fixed > the overflow bug then maybe this isn't a problem. I haven't looked. hur_size calculates total size as size of the struct hur (but using offset_of of it's last member that's a zero-sized array + whatever the size of the follow on items. Bye, Oleg-- 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 v7 1/2] phy: Add new Exynos5 USB 3.0 PHY driver
Hi Kishon, Tomasz, On Mon, Apr 28, 2014 at 11:47 AM, Vivek Gautam wrote: > Add a new driver for the USB 3.0 PHY on Exynos5 series of SoCs. > The new driver uses the generic PHY framework and will interact > with DWC3 controller present on Exynos5 series of SoCs. > Thereby, removing old phy-samsung-usb3 driver and related code > used untill now which was based on usb/phy framework. > > Signed-off-by: Vivek Gautam > --- Does this patch looks Ok now ? Actually we plan to get this in for 3.16, so if things are good we can get a go ahead for this :-) > > Changes from v6: > - Addressed review comments: >-- Sorted config entries in Kconfig and Makefile >-- Made #define to_usbdrd_phy(inst) to a static inline routine. >-- Restructured exynos5_rate_to_clk() as suggested. >-- Amended 'val' field for regmap_update_bits() in the routine > exynos5_usbdrd_phy_isol(). >-- Removed sentinel entry from exynos5_usbdrd_phy_cfg[] struct. >-- Removed check for 'match' entry in probe(). > > .../devicetree/bindings/phy/samsung-phy.txt| 40 ++ > drivers/phy/Kconfig| 11 + > drivers/phy/Makefile |1 + > drivers/phy/phy-exynos5-usbdrd.c | 627 > > 4 files changed, 679 insertions(+) > create mode 100644 drivers/phy/phy-exynos5-usbdrd.c > > diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt > b/Documentation/devicetree/bindings/phy/samsung-phy.txt > index b422e38..51efe4c 100644 > --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt > +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt > @@ -114,3 +114,43 @@ Example: > compatible = "samsung,exynos-sataphy-i2c"; > reg = <0x38>; > }; > + > +Samsung Exynos5 SoC series USB DRD PHY controller > +-- > + > +Required properties: > +- compatible : Should be set to one of the following supported values: > + - "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC, > + - "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC. > +- reg : Register offset and length of USB DRD PHY register set; > +- clocks: Clock IDs array as required by the controller > +- clock-names: names of clocks correseponding to IDs in the clock property; > + Required clocks: > + - phy: main PHY clock (same as USB DRD controller i.e. DWC3 IP clock), > + used for register access. > + - ref: PHY's reference clock (usually crystal clock), used for > + PHY operations, associated by phy name. It is used to > + determine bit values for clock settings register. > + For Exynos5420 this is given as 'sclk_usbphy30' in CMU. > +- samsung,pmu-syscon: phandle for PMU system controller interface, used to > + control pmu registers for power isolation. > +- samsung,pmu-offset: phy power control register offset to > pmu-system-controller > + base. > +- #phy-cells : from the generic PHY bindings, must be 1; > + > +For "samsung,exynos5250-usbdrd-phy" and "samsung,exynos5420-usbdrd-phy" > +compatible PHYs, the second cell in the PHY specifier identifies the > +PHY id, which is interpreted as follows: > + 0 - UTMI+ type phy, > + 1 - PIPE3 type phy, > + > +Example: > + usb3_phy: usbphy@1210 { > + compatible = "samsung,exynos5250-usbdrd-phy"; > + reg = <0x1210 0x100>; > + clocks = < 286>, < 1>; > + clock-names = "phy", "ref"; > + samsung,pmu-syscon = <_system_controller>; > + samsung,pmu-offset = <0x704>; > + #phy-cells = <1>; > + }; > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig > index 3bb05f1..daa1707 100644 > --- a/drivers/phy/Kconfig > +++ b/drivers/phy/Kconfig > @@ -159,6 +159,17 @@ config PHY_EXYNOS5250_USB2 > particular SoC is compiled in the driver. In case of Exynos 5250 > four > phys are available - device, host, HSIC0 and HSIC. > > +config PHY_EXYNOS5_USBDRD > + tristate "Exynos5 SoC series USB DRD PHY driver" > + depends on ARCH_EXYNOS5 && OF > + depends on HAS_IOMEM > + select GENERIC_PHY > + select MFD_SYSCON > + help > + Enable USB DRD PHY support for Exynos 5 SoC series. > + This driver provides PHY interface for USB 3.0 DRD controller > + present on Exynos5 SoC series. > + > config PHY_XGENE > tristate "APM X-Gene 15Gbps PHY support" > depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST) > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile > index 2faf78e..333ba98 100644 > --- a/drivers/phy/Makefile > +++ b/drivers/phy/Makefile > @@ -17,4 +17,5 @@ obj-$(CONFIG_PHY_SAMSUNG_USB2)+= > phy-samsung-usb2.o > obj-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o >
Re: [PATCH 11/47] staging/lustre/ptlrpc: add rpc_cache
Hello! On Apr 29, 2014, at 5:46 AM, Dan Carpenter wrote: >> >> +/* Fall through */ >> case 7: >> sptlrpc_fini(); >> -case 5: >> +/* Fall through */ >> +case 6: >> ldlm_exit(); >> -case 4: >> +/* Fall through */ >> +case 5: >> ptlrpc_stop_pinger(); >> -case 3: >> +/* Fall through */ >> +case 4: >> ptlrpc_connection_fini(); >> -case 2: >> +/* Fall through */ >> +case 3: >> ptlrpc_exit_portals(); >> +/* Fall through */ >> +case 2: >> +ptlrpc_request_cache_fini(); >> +/* Fall through */ >> case 1: >> ptlrpc_hr_fini(); >> req_layout_fini(); >> +/* Fall through */ >> default: ; >> } >> > > Heh. Oh wow. That's horrible. :P > > Hopefully next time someone will fix this pile of monkey poo instead > just renumbering all the grains of corn. Agreed. We actually have it fixed, but it again came with some other rework that we are probably not ready to merge anywhere yet. I guess I can extract just this cleanup ahead of time. Bye, Oleg -- 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 41/47] staging/lustre/llite: remove dead code
Hello! On Apr 29, 2014, at 7:02 AM, Dan Carpenter wrote: >> diff --git a/drivers/staging/lustre/lustre/llite/statahead.c >> b/drivers/staging/lustre/lustre/llite/statahead.c >> index 51c5327..1b47774 100644 >> --- a/drivers/staging/lustre/lustre/llite/statahead.c >> +++ b/drivers/staging/lustre/lustre/llite/statahead.c >> @@ -1230,9 +1230,7 @@ do_it: >> */ >> ll_release_page(page, le32_to_cpu(dp->ldp_flags) & >>LDF_COLLIDE); >> -sai->sai_in_readpage = 1; >> page = ll_get_dir_page(dir, pos, ); >> -sai->sai_in_readpage = 0; >> } else { >> LASSERT(le32_to_cpu(dp->ldp_flags) & LDF_COLLIDE); >> ll_release_page(page, 1); >> @@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, struct >> dentry **dentryp, >> return entry ? 1 : -EAGAIN; >> } >> >> -/* if statahead is busy in readdir, help it do post-work */ >> -while (!ll_sa_entry_stated(entry) && >> - sai->sai_in_readpage && >> - !sa_received_empty(sai)) >> -ll_post_statahead(sai); >> - >> if (!ll_sa_entry_stated(entry)) { >> sai->sai_index_wait = entry->se_index; >> lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL, > > What is this change about really? I've already waded through 1271 lines > of random changes at this point and now I have to figure out what > ll_post_statahead() does and why we don't need to call it now? > > Anyways, please explain this change. Ok, so after some digging. The first hunk of the above was gone in our code with the move of a lot of directory processing down onto mdc layer as part of support for multiple metadata servers (a new feature). Then the second hunk was the cleanup sine nobody was setting the sai_in_readpage ever. sai_in_readpage in itself originally was devised as performance optimization for the case where the statahead thread is waiting for READDIR RPC to return while there are already some GETATTR RPCs that have already returned and are waiting to be interpreted. This does not affect correctness in any way, though. And removing it brings the code closer to our current tree which is hopefully a good thing. I can rediff this patch with this particular part dropped if there are any concerns and it's possible to reintegrate it in a changed form. Bye, Oleg-- 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/Processor: Fix failure of loading acpi-cpufreq driver
According commit d640113fe(ACPI: processor: fix acpi_get_cpuid for UP processor), Bios may not provide _MAT or MADT tables and acpi_get_apicid() always returns -1. For these cases, original code will pass apic_id with vaule of -1 to acpi_map_cpuid() and it will check the acpi_id. If acpi_id is equal to zero, ignores apic_id and return zero for CPU0. Commit b981513(ACPI / scan: bail out early if failed to parse APIC ID for CPU) changed the behavior. Return ENODEV when find apic_id is less than zero after calling acpi_get_apicid(). This causes acpi-cpufreq driver fails to be loaded on some machines. This patch is to fix it. Reference:https://bugzilla.kernel.org/show_bug.cgi?id=73781 Cc: sta...@vger.kernel.org v3.14 Reported-and-tested-by: KATO Hiroshi Reported-and-tested-by: Stuart Foster Signed-off-by: Lan Tianyu --- drivers/acpi/acpi_processor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c29c2c3..d55b603 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -260,10 +260,8 @@ static int acpi_processor_get_info(struct acpi_device *device) } apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); - if (apic_id < 0) { + if (apic_id < 0) acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); - return -ENODEV; - } pr->apic_id = apic_id; cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); -- 1.8.4.rc0.1.g8f6a3e5.dirty -- 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: [alsa-devel] [PATCH 01/15] ASoC: CS42L51 and WM8962 codecs depend on INPUT
On Tue, 29 Apr 2014, Xia Kaixu wrote: From: Arnd Bergmann Building ARM randconfig got into a situation where CONFIG_INPUT is turned off and SND_SOC_ALL_CODECS is turned on, which failed for two codecs trying to use the input subsystem. Some other drivers also select one of these codecs and consequently need an explicit dependency added. I assume you mean the CS42L52 instead of the L51. INPUT is used for a BEEP Generator but when I disable CONFIG_INPUT I do not get an error. Is there any information available on what the error is? Appending to the dependency list seems the easiest way out, since this is not a practical limitation. If anyone really needs to build these codecs for a kernel with no input support, a more sophisticated solution can be implemented. It shouldn't build the BEEP code without CONFIG_INPUT enabled as you can use the CODEC without the BEEP enabled. I believe the WM8962 is done the same way. Thanks, Brian -- 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] lib/spinlock_debug: avoid one thread can not obtain the spinlock for a long time.
loops_per_jiffy is larger than expectation that possible causes one thread can not obtain the spin lock for a long time. So use cpu_clock() to reach timeout in one second which can avoid HARD LOCKUP. Signed-off-by: Chuansheng Liu Signed-off-by: xiaoming wang --- kernel/locking/spinlock_debug.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/kernel/locking/spinlock_debug.c b/kernel/locking/spinlock_debug.c index 0374a59..5d3c4f3 100644 --- a/kernel/locking/spinlock_debug.c +++ b/kernel/locking/spinlock_debug.c @@ -105,13 +105,19 @@ static inline void debug_spin_unlock(raw_spinlock_t *lock) static void __spin_lock_debug(raw_spinlock_t *lock) { - u64 i; + u64 i, t; u64 loops = loops_per_jiffy * HZ; + u64 one_second = 10; + u32 this_cpu = raw_smp_processor_id(); + + t = cpu_clock(this_cpu); for (i = 0; i < loops; i++) { if (arch_spin_trylock(>raw_lock)) return; __delay(1); + if (cpu_clock(this_cpu) - t > one_second) + break; } /* lockup suspected: */ spin_dump(lock, "lockup suspected"); -- 1.7.1 -- 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: OMAP5: Switch to THUMB mode if needed on secondary CPU
On 04/29/2014 01:31 PM, Dave Martin wrote: > On Tue, Apr 29, 2014 at 05:36:30PM +0100, Joel Fernandes wrote: > > [...] > Sorry what I meant is, say its of Type function. What tells the firmware to switch to THUMB? What's typically done is a boot address register is written by the kernel, and the firmware jumps to it after WFE. >>> >>> Using ENTRY(x) ... ENDPROC(x) causes the symbol seen by the linker >>> for x to have the Thumb bit set if the code is Thumb. >>> >>> This means that any reference the linker fixes up for that symbol >>> will have the Thumb bit set appropriately. This applies to any kind >>> of reference, so code in another file that takes the address of the >>> symbol and then passes that address to the firmware should result in the >>> firmware getting an address with the Thumb bit. >>> >>> From the firmware's point of view it just gets a raw address, but >>> the Thumb bit will now be set. The firmware still needs to handle >>> this correctly when jumping, but from the look of the code this may >>> already work on omap3/4. It would be interesting to know whether it >>> works on omap5. >> >> Thanks a lot for the explanation. That makes perfect sense. I will try it >> and let you know if it works on OMAP5. > > ARM/thumb interworking making perfect sense? I'll have to frame that > and put it on the wall :) > > objdump and nm conveniently mask off the Thumb bit from all function > addresses they print out, but if you show the symbols using readelf > instead you'll see addresses with bit 0 set for Thumb functions. > > It's possible that the firmware still doesn't handle branching to Thumb > correctly, but if it does it would be nice to remove the requirement to > build an odd piece of a Thumb-2 kernel in ARM. Sure, it works great! thanks, I sent out a patch that applies on top of the first one. Thanks for spotting it. Regards, -Joel -- 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: dcache shrink list corruption?
On Tue, Apr 29, 2014 at 7:31 PM, Al Viro wrote: > > OK, aggregate diff follows, more readable splitup (3 commits) attached. > It seems to survive beating here; testing, review and comments are > welcome. Miklos, did you have some particular load that triggered this, or was it just some reports? It would be really good to get this patch some stress-testing. I like how the patch removes more lines than it adds, but apart from that it's hard to read the patch (even the split-out ones) and say anything more about it. I think this needs a *lot* of testing. Linus -- 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: OMAP5: Redo THUMB mode switch on secondary CPU
Here's a redo of the patch [1] that effectively does the same thing but is the right way to do things by using ENDPROC instead. The firmware correctly switches to THUMB before entry. The patch applies ontop of the earlier patch [1]. [1] https://lkml.org/lkml/2014/4/22/1044 Suggested-by: Dave Martin Cc: Dave Martin Cc: Santosh Shilimkar Cc: Russell King Cc: Nishanth Menon Cc: Tony Lindgren Signed-off-by: Joel Fernandes --- Tony, the earlier patch went into your fixes, and can remain. This patch is just a simple redo of the same and can go in for v3.16, no problem. Thanks. arch/arm/mach-omap2/omap-headsmp.S |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S index 1809dce..bf36f26 100644 --- a/arch/arm/mach-omap2/omap-headsmp.S +++ b/arch/arm/mach-omap2/omap-headsmp.S @@ -31,10 +31,6 @@ * register AuxCoreBoot0. */ ENTRY(omap5_secondary_startup) -.arm -THUMB( adr r9, BSYM(wait) ) @ CPU may be entered in ARM mode. -THUMB( bx r9 ) @ If this is a Thumb-2 kernel, -THUMB( .thumb ) @ switch to Thumb now. wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 ldr r0, [r2] mov r0, r0, lsr #5 @@ -43,7 +39,7 @@ wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 cmp r0, r4 bne wait b secondary_startup -END(omap5_secondary_startup) +ENDPROC(omap5_secondary_startup) /* * OMAP4 specific entry point for secondary CPU to jump from ROM * code. This routine also provides a holding flag into which -- 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 v4 2/7] arm64: Decouple page size from level of translation tables
On Tuesday, April 29, 2014 11:41 PM, Catalin Marinas wrote: > Jungseok, Hi, Catalin > On Tue, Apr 29, 2014 at 05:59:20AM +0100, Jungseok Lee wrote: > > +choice > > + prompt "Level of translation tables" > > + default ARM64_3_LEVELS if ARM64_4K_PAGES > > + default ARM64_2_LEVELS if ARM64_64K_PAGES > > + help > > + Allows level of translation tables. > > + > > +config ARM64_2_LEVELS > > + bool "2 level" > > + depends on ARM64_64K_PAGES > > + help > > + This feature enables 2 levels of translation tables. > > + > > +config ARM64_3_LEVELS > > + bool "3 level" > > + depends on ARM64_4K_PAGES > > + help > > + This feature enables 3 levels of translation tables. > > + > > +endchoice > > As I mentioned previously > (http://www.spinics.net/linux/lists/arm-kernel/msg319552.html), just expose > options for the VA space > bits rather than the number of levels. > You can still keep the number of levels config options but not visible in > menuconfig (though I think > you could also hide them in some header and avoid config altogether). The VA > bits config options can > be: > > VA_BITS_39 if 4K (3 levels) > VA_BITS_42 if 64K (2 levels) > VA_BITS_47 if 16K (3 levels) > VA_BITS_48 if 4K || 16K || 64K (4/4/3 levels depending on page size) > > That's more meaningful to people configuring the kernel. Okay, I will revise VA_BITS config as hiding the number of levels. Best Regards Jungseok Lee -- 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/
linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree
Hi all, Today's linux-next merge of the drm-intel tree got a conflict in drivers/gpu/drm/i915/i915_gem_gtt.c between commitcfa7c862982b ("drm/i915: Sanitize the enable_ppgtt module option once") from the drm-intel-fixes tree tree and commit 5db6c735ead5 ("drm/i915: dmesg output for VT-d testing") from the drm-intel tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/gpu/drm/i915/i915_gem_gtt.c index 154b0f8bb88d,496916298e8a.. --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@@ -62,62 -48,13 +62,9 @@@ static int sanitize_enable_ppgtt(struc } #endif - /* Full ppgtt disabled by default for now due to issues. */ - if (full) - return HAS_PPGTT(dev) && (i915.enable_ppgtt == 2); - else - return HAS_ALIASING_PPGTT(dev); + return HAS_ALIASING_PPGTT(dev) ? 1 : 0; } - #define GEN6_PPGTT_PD_ENTRIES 512 - #define I915_PPGTT_PT_ENTRIES (PAGE_SIZE / sizeof(gen6_gtt_pte_t)) - typedef uint64_t gen8_gtt_pte_t; - typedef gen8_gtt_pte_t gen8_ppgtt_pde_t; - - /* PPGTT stuff */ - #define GEN6_GTT_ADDR_ENCODE(addr)((addr) | (((addr) >> 28) & 0xff0)) - #define HSW_GTT_ADDR_ENCODE(addr) ((addr) | (((addr) >> 28) & 0x7f0)) - - #define GEN6_PDE_VALID(1 << 0) - /* gen6+ has bit 11-4 for physical addr bit 39-32 */ - #define GEN6_PDE_ADDR_ENCODE(addr)GEN6_GTT_ADDR_ENCODE(addr) - - #define GEN6_PTE_VALID(1 << 0) - #define GEN6_PTE_UNCACHED (1 << 1) - #define HSW_PTE_UNCACHED (0) - #define GEN6_PTE_CACHE_LLC(2 << 1) - #define GEN7_PTE_CACHE_L3_LLC (3 << 1) - #define GEN6_PTE_ADDR_ENCODE(addr)GEN6_GTT_ADDR_ENCODE(addr) - #define HSW_PTE_ADDR_ENCODE(addr) HSW_GTT_ADDR_ENCODE(addr) - - /* Cacheability Control is a 4-bit value. The low three bits are stored in * - * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE. - */ - #define HSW_CACHEABILITY_CONTROL(bits)bits) & 0x7) << 1) | \ -(((bits) & 0x8) << (11 - 3))) - #define HSW_WB_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x2) - #define HSW_WB_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x3) - #define HSW_WB_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0xb) - #define HSW_WB_ELLC_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x8) - #define HSW_WT_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x6) - #define HSW_WT_ELLC_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x7) - - #define GEN8_PTES_PER_PAGE(PAGE_SIZE / sizeof(gen8_gtt_pte_t)) - #define GEN8_PDES_PER_PAGE(PAGE_SIZE / sizeof(gen8_ppgtt_pde_t)) - - /* GEN8 legacy style addressis defined as a 3 level page table: - * 31:30 | 29:21 | 20:12 | 11:0 - * PDPE | PDE | PTE | offset - * The difference as compared to normal x86 3 level page table is the PDPEs are - * programmed via register. - */ - #define GEN8_PDPE_SHIFT 30 - #define GEN8_PDPE_MASK0x3 - #define GEN8_PDE_SHIFT21 - #define GEN8_PDE_MASK 0x1ff - #define GEN8_PTE_SHIFT12 - #define GEN8_PTE_MASK 0x1ff - - #define PPAT_UNCACHED_INDEX (_PAGE_PWT | _PAGE_PCD) - #define PPAT_CACHED_PDE_INDEX 0 /* WB LLC */ - #define PPAT_CACHED_INDEX _PAGE_PAT /* WB LLCeLLC */ - #define PPAT_DISPLAY_ELLC_INDEX _PAGE_PCD /* WT eLLC */ static void ppgtt_bind_vma(struct i915_vma *vma, enum i915_cache_level cache_level, @@@ -2041,14 -1971,10 +1981,18 @@@ int i915_gem_gtt_init(struct drm_devic gtt->base.total >> 20); DRM_DEBUG_DRIVER("GMADR size = %ldM\n", gtt->mappable_end >> 20); DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", gtt->stolen_size >> 20); + /* + * i915.enable_ppgtt is read-only, so do an early pass to validate the + * user's requested state against the hardware/driver capabilities. We + * do this now so that we can print out any log messages once rather + * than every time we check intel_enable_ppgtt(). + */ + i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt); + DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915.enable_ppgtt); + #ifdef CONFIG_INTEL_IOMMU + if (intel_iommu_gfx_mapped) + DRM_INFO("VT-d active for gfx access\n"); + #endif return 0; } pgpD1Fz5VNPHN.pgp Description: PGP signature
[PATCH 2/4] f2fs: avoid grab_cache_page_write_begin for data pages
We don't need to wait on page writeback for these cases. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 4 ++-- fs/f2fs/inline.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 273fe16..91ff104 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -417,7 +417,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) if (unlikely(dn.data_blkaddr == NEW_ADDR)) return ERR_PTR(-EINVAL); - page = grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); + page = grab_cache_page(mapping, index); if (!page) return ERR_PTR(-ENOMEM); @@ -455,7 +455,7 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index) int err; repeat: - page = grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); + page = grab_cache_page(mapping, index); if (!page) return ERR_PTR(-ENOMEM); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 8bf34f0..1bba522 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -95,6 +95,7 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) if (err) goto out; + f2fs_wait_on_page_writeback(page, DATA); zero_user_segment(page, MAX_INLINE_DATA, PAGE_CACHE_SIZE); /* Copy the whole inline data block */ @@ -133,7 +134,7 @@ int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size) else if (to_size <= MAX_INLINE_DATA) return 0; - page = grab_cache_page_write_begin(inode->i_mapping, 0, AOP_FLAG_NOFS); + page = grab_cache_page(inode->i_mapping, 0); if (!page) return -ENOMEM; -- 1.8.4.474.g128a96c -- 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] f2fs: no need to wait on page writebck to meta pages
This patch removes grab_cache_page_write_begin for meta pages. Signed-off-by: Jaegeuk Kim --- fs/f2fs/checkpoint.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 1346ce9..b6f6ead 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -33,11 +33,14 @@ struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) struct address_space *mapping = META_MAPPING(sbi); struct page *page = NULL; repeat: - page = grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); + page = grab_cache_page(mapping, index); if (!page) { cond_resched(); goto repeat; } + /* meta pages should not be under writeback */ + if (PageWriteback(page)) + WARN_ON(1); SetPageUptodate(page); return page; -- 1.8.4.474.g128a96c -- 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] f2fs: split grab_cache_page and wait_on_page_writeback for node pages
This patch splits grab_cache_page_write_begin into grab_cache_page and wait_on_page_writeback for node pages. This patch intends to enhance the latency to get node pages by alleviating unnecessary wait_on_page_writeback. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/dir.c| 2 ++ fs/f2fs/inline.c | 6 ++ fs/f2fs/node.c | 8 fs/f2fs/node.h | 2 +- fs/f2fs/xattr.c | 3 +++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 3581c2b..c3f1485 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -268,6 +268,8 @@ static void init_dent_inode(const struct qstr *name, struct page *ipage) { struct f2fs_inode *ri; + f2fs_wait_on_page_writeback(ipage, NODE); + /* copy name info. to this inode page */ ri = F2FS_INODE(ipage); ri->i_namelen = cpu_to_le32(name->len); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index d215dbb..8bf34f0 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -156,6 +156,7 @@ int f2fs_write_inline_data(struct inode *inode, return err; ipage = dn.inode_page; + f2fs_wait_on_page_writeback(ipage, NODE); zero_user_segment(ipage, INLINE_DATA_OFFSET, INLINE_DATA_OFFSET + MAX_INLINE_DATA); src_addr = kmap(page); @@ -188,6 +189,8 @@ void truncate_inline_data(struct inode *inode, u64 from) if (IS_ERR(ipage)) return; + f2fs_wait_on_page_writeback(ipage, NODE); + zero_user_segment(ipage, INLINE_DATA_OFFSET + from, INLINE_DATA_OFFSET + MAX_INLINE_DATA); set_page_dirty(ipage); @@ -218,6 +221,8 @@ process_inline: ipage = get_node_page(sbi, inode->i_ino); f2fs_bug_on(IS_ERR(ipage)); + f2fs_wait_on_page_writeback(ipage, NODE); + src_addr = inline_data_addr(npage); dst_addr = inline_data_addr(ipage); memcpy(dst_addr, src_addr, MAX_INLINE_DATA); @@ -229,6 +234,7 @@ process_inline: if (f2fs_has_inline_data(inode)) { ipage = get_node_page(sbi, inode->i_ino); f2fs_bug_on(IS_ERR(ipage)); + f2fs_wait_on_page_writeback(ipage, NODE); zero_user_segment(ipage, INLINE_DATA_OFFSET, INLINE_DATA_OFFSET + MAX_INLINE_DATA); clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 2803ef6..059aaf5 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -853,8 +853,7 @@ struct page *new_node_page(struct dnode_of_data *dn, if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) return ERR_PTR(-EPERM); - page = grab_cache_page_write_begin(NODE_MAPPING(sbi), - dn->nid, AOP_FLAG_NOFS); + page = grab_cache_page(NODE_MAPPING(sbi), dn->nid); if (!page) return ERR_PTR(-ENOMEM); @@ -871,6 +870,7 @@ struct page *new_node_page(struct dnode_of_data *dn, new_ni.ino = dn->inode->i_ino; set_node_addr(sbi, _ni, NEW_ADDR, false); + f2fs_wait_on_page_writeback(page, NODE); fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); set_cold_node(dn->inode, page); SetPageUptodate(page); @@ -950,8 +950,7 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) struct page *page; int err; repeat: - page = grab_cache_page_write_begin(NODE_MAPPING(sbi), - nid, AOP_FLAG_NOFS); + page = grab_cache_page(NODE_MAPPING(sbi), nid); if (!page) return ERR_PTR(-ENOMEM); @@ -1562,6 +1561,7 @@ static void recover_inline_xattr(struct inode *inode, struct page *page) src_addr = inline_xattr_addr(page); inline_size = inline_xattr_size(inode); + f2fs_wait_on_page_writeback(ipage, NODE); memcpy(dst_addr, src_addr, inline_size); update_inode(inode, ipage); diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h index a076c88..4ee29d5 100644 --- a/fs/f2fs/node.h +++ b/fs/f2fs/node.h @@ -272,7 +272,7 @@ static inline void set_nid(struct page *p, int off, nid_t nid, bool i) { struct f2fs_node *rn = F2FS_NODE(p); - wait_on_page_writeback(p); + f2fs_wait_on_page_writeback(p, NODE); if (i) rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid); diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 6073f9f..1f546b4 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -349,6 +349,7 @@ static inline int write_all_xattrs(struct inode *inode, __u32 hsize, if (ipage) { inline_addr = inline_xattr_addr(ipage); + f2fs_wait_on_page_writeback(ipage, NODE); } else { page = get_node_page(sbi,
[PATCH 4/4] f2fs: decrease the lock granularity during write_begin
This patch reduces the lock granularity during write_begin. When the system is under memory pressure, it would be better to reduce the locking time for the data pages. Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 91ff104..a7bb98f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -909,6 +909,10 @@ repeat: page = grab_cache_page_write_begin(mapping, index, flags); if (!page) return -ENOMEM; + + /* to avoid latency during memory pressure */ + unlock_page(page); + *pagep = page; if (f2fs_has_inline_data(inode) && (pos + len) <= MAX_INLINE_DATA) @@ -920,10 +924,18 @@ repeat: f2fs_unlock_op(sbi); if (err) { - f2fs_put_page(page, 1); + f2fs_put_page(page, 0); return err; } inline_data: + lock_page(page); + if (unlikely(page->mapping != mapping)) { + f2fs_put_page(page, 1); + goto repeat; + } + + f2fs_wait_on_page_writeback(page, DATA); + if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) return 0; -- 1.8.4.474.g128a96c -- 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 v4 1/7] arm64: Use pr_* instead of printk
On Wednesday, April 30, 2014 5:35 AM, Mitchel Humpherys wrote: > On Mon, Apr 28 2014 at 09:59:14 PM, Jungseok Lee wrote: > > This patch fixed the following checkpatch complaint as using pr_* > > instead of printk. > > > > WARNING: printk() should include KERN_ facility level > > > > Cc: Catalin Marinas > > Signed-off-by: Jungseok Lee > > Reviewed-by: Sungjinn Chung > > --- > > arch/arm64/kernel/traps.c | 14 +++--- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > > index 7ffaddd..0484e81 100644 > > --- a/arch/arm64/kernel/traps.c > > +++ b/arch/arm64/kernel/traps.c > > @@ -65,7 +65,7 @@ static void dump_mem(const char *lvl, const char *str, > > unsigned long bottom, > > fs = get_fs(); > > set_fs(KERNEL_DS); > > > > - printk("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); > > + pr_emerg("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); > > Currently this printk is being called with lvl=KERN_EMERG or lvl="". In the > case of lvl=KERN_EMERG > leaving lvl in is redundant. In the case of lvl="" this is a behavioral > change (printing to a > different log level). Was this intended? No intention. I will drop the change in the next version. Thanks!! Best Regards Jungseok Lee -- 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: dcache shrink list corruption?
On Wed, Apr 30, 2014 at 12:20:13AM +0100, Al Viro wrote: > On Tue, Apr 29, 2014 at 04:04:11PM -0700, Linus Torvalds wrote: > > But at a minimum, we have "d_op->d_prune()" that would now be possibly > > be called for the old dentry *after* a new dentry has been allocated. > > Not to mention the inode not having been dropped. So it looks like a > > disaster where the filesystem now ends up having concurrent "live" > > dentries for the same entry. Even if one of them is on its way out, > > it's still visible to the filesystem. That makes me very > > uncomfortable. > > > > I'm starting to think that Miklos' original patch (perhaps with the > > spinlock split to at least be one per superblock) is the most > > straightforward approach after all. It's annoying having to add locks > > here, but the whole pruning path should not be a hotpath, so maybe > > it's not actually a big deal. > > FWIW, my solution is more or less working; I'll give more local beating > and post it... OK, aggregate diff follows, more readable splitup (3 commits) attached. It seems to survive beating here; testing, review and comments are welcome. diff --git a/fs/dcache.c b/fs/dcache.c index 494a9def..a83b933 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -246,16 +246,8 @@ static void __d_free(struct rcu_head *head) kmem_cache_free(dentry_cache, dentry); } -/* - * no locks, please. - */ -static void d_free(struct dentry *dentry) +static void dentry_free(struct dentry *dentry) { - BUG_ON((int)dentry->d_lockref.count > 0); - this_cpu_dec(nr_dentry); - if (dentry->d_op && dentry->d_op->d_release) - dentry->d_op->d_release(dentry); - /* if dentry was never visible to RCU, immediate free is OK */ if (!(dentry->d_flags & DCACHE_RCUACCESS)) __d_free(>d_u.d_rcu); @@ -420,40 +412,6 @@ static void dentry_lru_del(struct dentry *dentry) } /** - * d_kill - kill dentry and return parent - * @dentry: dentry to kill - * @parent: parent dentry - * - * The dentry must already be unhashed and removed from the LRU. - * - * If this is the root of the dentry tree, return NULL. - * - * dentry->d_lock and parent->d_lock must be held by caller, and are dropped by - * d_kill. - */ -static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) - __releases(dentry->d_lock) - __releases(parent->d_lock) - __releases(dentry->d_inode->i_lock) -{ - list_del(>d_u.d_child); - /* -* Inform d_walk() that we are no longer attached to the -* dentry tree -*/ - dentry->d_flags |= DCACHE_DENTRY_KILLED; - if (parent) - spin_unlock(>d_lock); - dentry_iput(dentry); - /* -* dentry_iput drops the locks, at which point nobody (except -* transient RCU lookups) can reach this dentry. -*/ - d_free(dentry); - return parent; -} - -/** * d_drop - drop a dentry * @dentry: dentry to drop * @@ -499,6 +457,8 @@ void d_drop(struct dentry *dentry) } EXPORT_SYMBOL(d_drop); +static DECLARE_WAIT_QUEUE_HEAD(free_wq); + /* * Finish off a dentry we've decided to kill. * dentry->d_lock must be held, returns with it unlocked. @@ -506,16 +466,17 @@ EXPORT_SYMBOL(d_drop); * Returns dentry requiring refcount drop, or NULL if we're done. */ static struct dentry * -dentry_kill(struct dentry *dentry, int unlock_on_failure) +dentry_kill(struct dentry *dentry, struct list_head *morgue) __releases(dentry->d_lock) { struct inode *inode; struct dentry *parent; + bool can_free = true; inode = dentry->d_inode; if (inode && !spin_trylock(>i_lock)) { relock: - if (unlock_on_failure) { + if (!morgue) { spin_unlock(>d_lock); cpu_relax(); } @@ -531,6 +492,15 @@ relock: goto relock; } + if (unlikely(dentry->d_flags & DCACHE_DENTRY_KILLED)) { + /* morgue must be non-NULL */ + list_move(>d_lru, morgue); + if (parent) + spin_unlock(>d_lock); + /* inode must be NULL */ + spin_unlock(>d_lock); + return parent; + } /* * The dentry is now unrecoverably dead to the world. */ @@ -543,10 +513,43 @@ relock: if ((dentry->d_flags & DCACHE_OP_PRUNE) && !d_unhashed(dentry)) dentry->d_op->d_prune(dentry); - dentry_lru_del(dentry); + if (dentry->d_flags & DCACHE_LRU_LIST) { + if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) + d_lru_del(dentry); + else if (morgue) + d_shrink_del(dentry); + else + can_free = false; + } /* if it was on the hash then remove it */ __d_drop(dentry); - return d_kill(dentry, parent); +
Re: [PATCH/RFC] SCHED: allow wait_on_bit functions to support a timeout.
On Tue, 29 Apr 2014 12:32:17 +0200 Peter Zijlstra wrote: > So I'm sure I'm not getting it; but why is all the wait_bit crap so > entirely different from the normal wait stuff? > > Surely something like: > > wait_event_timeout(, test_bit(bit, word), timeout); > > Is pretty much the same, no? The only thing that's different is the wake > function, but surely we can thread that into there somehow without all > this silly repetition. > > Furthermore, I count about 23 action functions, of which there appear to > be only like 4 actual variants. Surely such repetition sucks arse and > should be avoided? > What do you think of the following as a cleanup prior to my patch. It will make my patch a lot smaller and removes a lot of the duplication that you don't like. It renames the current wait_on_bit{_lock} function to have a "_cmd" suffix and introduces versions which are not passed an action function (maybe it should be an "_action" suffix...). wait_on_bit() and wait_on_bit_lock() use schedule(), wait_on_bit_io() and wait_on_bit_lock_io() use io_schedule(). The bit_wait() and bit_wait_io() function that these pass through use signal_pending_state() to determine if they should abort or [io_]schedule(). I think the code is right, but it is the bit I would particularly like you to check. The return value from wait_on_bit{,_lock} is 0 or non-zero. Functions which wanted a particular error code need to interpolate that themselves. (somewhat amusingly, fs/fscache/cookie.c currently has wait_on_bit(>flags, FSCACHE_COOKIE_INVALIDATING, fscache_wait_bit_interruptible, TASK_UNINTERRUPTIBLE); which is a little bit interruptible, but mostly not...) If you think it is a good cleanup I'll post a proper patch with all the right Cc:s. Thanks, NeilBrown diff --git a/include/linux/wait.h b/include/linux/wait.h index 559044c79232..13e6fd9acf09 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -854,7 +854,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); } while (0) /** - * wait_on_bit - wait for a bit to be cleared + * wait_on_bit_cmd - wait for a bit to be cleared * @word: the word being waited on, a kernel virtual address * @bit: the bit of the word being waited on * @action: the function used to sleep, which may take special actions @@ -868,15 +868,51 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); * but has no intention of setting it. */ static inline int -wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) +wait_on_bit_cmd(void *word, int bit, int (*action)(void *), unsigned mode) { if (!test_bit(bit, word)) return 0; return out_of_line_wait_on_bit(word, bit, action, mode); } +extern int bit_wait(void *); +extern int bit_wait_io(void *); + /** - * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it + * wait_on_bit - wait for a bit to be cleared + * @word: the word being waited on, a kernel virtual address + * @bit: the bit of the word being waited on + * @mode: the task state to sleep in + * + * There is a standard hashed waitqueue table for generic use. This + * is the part of the hashtable's accessor API that waits on a bit. + * For instance, if one were to have waiters on a bitflag, one would + * call wait_on_bit() in threads waiting for the bit to clear. + * One uses wait_on_bit() where one is waiting for the bit to clear, + * but has no intention of setting it. + */ +static inline int +wait_on_bit(void *word, int bit, unsigned mode) +{ + if (!test_bit(bit, word)) + return 0; + return out_of_line_wait_on_bit(word, bit, + bit_wait, + mode & 65535); +} + +static inline int +wait_on_bit_io(void *word, int bit, unsigned mode) +{ + if (!test_bit(bit, word)) + return 0; + return out_of_line_wait_on_bit(word, bit, + bit_wait_io, + mode & 65535); +} + +/** + * wait_on_bit_lock_cmd - wait for a bit to be cleared, when wanting to set it * @word: the word being waited on, a kernel virtual address * @bit: the bit of the word being waited on * @action: the function used to sleep, which may take special actions @@ -892,7 +928,7 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) * clear with the intention of setting it, and when done, clearing it. */ static inline int -wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) +wait_on_bit_lock_cmd(void *word, int bit, int (*action)(void *), unsigned mode) { if (!test_and_set_bit(bit, word)) return 0; @@ -900,6 +936,41 @@ wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) } /** + * wait_on_bit_lock - wait for a bit to be cleared, when
Re: [PATCH v4 6/7] arm64: mm: Implement 4 levels of translation tables
On Wednesday, April 30, 2014 2:04 AM, Catalin Marinas wrote: > On Tue, Apr 29, 2014 at 05:59:33AM +0100, Jungseok Lee wrote: > > diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index > > 0fd5650..03ec424 100644 > > --- a/arch/arm64/kernel/head.S > > +++ b/arch/arm64/kernel/head.S > > @@ -37,8 +37,9 @@ > > > > /* > > * swapper_pg_dir is the virtual address of the initial page table. > > We place > > - * the page tables 3 * PAGE_SIZE below KERNEL_RAM_VADDR. The > > idmap_pg_dir has > > - * 2 pages and is placed below swapper_pg_dir. > > + * the page tables 3 * PAGE_SIZE (2 or 3 levels) or 4 * PAGE_SIZE (4 > > + levels) > > + * below KERNEL_RAM_VADDR. The idmap_pg_dir has 2 pages (2 or 3 > > + levels) or > > + * 3 pages (4 levels) and is placed below swapper_pg_dir. > > */ > > #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) > > > > @@ -46,8 +47,13 @@ > > #error KERNEL_RAM_VADDR must start at 0xXXX8 #endif > > > > +#ifdef CONFIG_ARM64_4_LEVELS > > +#define SWAPPER_DIR_SIZE (4 * PAGE_SIZE) > > +#define IDMAP_DIR_SIZE (3 * PAGE_SIZE) > > +#else > > #define SWAPPER_DIR_SIZE (3 * PAGE_SIZE) > > #define IDMAP_DIR_SIZE (2 * PAGE_SIZE) > > +#endif > > Mark Rutland was doing some clean-up of this code to no longer place > swapper_pg_dir and idmap_pg_dir > below the kernel image. I'm not sure whether the patches ended up on the list > yet (not a problem for > now, just a slight change for your patches). I don't see those patches in the mailing list yet. I will keep it in mind. Thanks. Best Regards Jungseok Lee -- 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: [3.15-rc3] rtmutex-debug assertion.
On Tue, 2014-04-29 at 20:14 -0400, Dave Jones wrote: > On Tue, Apr 29, 2014 at 11:16:55AM -0400, Dave Jones wrote: > > Just hit this while fuzzing the futex() syscall. > > > > > > WARNING: CPU: 2 PID: 6202 at kernel/locking/rtmutex-debug.c:151 > debug_rt_mutex_proxy_unlock+0x4e/0x60() > > DEBUG_LOCKS_WARN_ON(!rt_mutex_owner(lock)) > > Modules linked in: > > tun fuse ipt_ULOG nfnetlink bnep can_bcm scsi_transport_iscsi nfc > caif_socket caif af_802154 ieee802154 phonet af_rxrpc can_raw can pppoe pppox > ppp_generic slhc irda crc_ccitt rds rose x25 atm netrom appletalk ipx p8023 > psnap p8022 llc ax25 cfg80211 coretemp hwmon x86_pkg_temp_thermal kvm_intel > kvm xfs libcrc32c btusb bluetooth snd_hda_codec_hdmi snd_hda_codec_realtek > snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec > snd_hwdep snd_seq snd_seq_device snd_pcm e1000e crct10dif_pclmul crc32c_intel > ghash_clmulni_intel snd_timer snd microcode serio_raw pcspkr usb_debug > 6lowpan_iphc rfkill shpchp ptp pps_core soundcore > > CPU: 2 PID: 6202 Comm: trinity-c63 Not tainted 3.15.0-rc3+ #201 > > 0009 de725d52 880099befbd8 92746dad > > 880099befc20 880099befc10 9206d46d 88020951c010 > > 88009d718000 88009d718000 c90011408680 c90011408688 > > Call Trace: > > [] dump_stack+0x4e/0x7a > > [] warn_slowpath_common+0x7d/0xa0 > > [] warn_slowpath_fmt+0x5c/0x80 > > [] debug_rt_mutex_proxy_unlock+0x4e/0x60 > > [] rt_mutex_proxy_unlock+0x17/0x40 > > [] free_pi_state+0x6a/0xb0 > > [] unqueue_me_pi+0x20/0x40 > > [] futex_lock_pi.isra.18+0x262/0x3f0 > > [] ? hrtimer_get_res+0x50/0x50 > > [] do_futex+0x2ec/0xb60 > > [] ? debug_smp_processor_id+0x17/0x20 > > [] ? put_lock_stats.isra.23+0xe/0x30 > > [] ? lock_release_holdtime.part.24+0xe6/0x160 > > [] ? get_parent_ip+0xd/0x50 > > [] ? preempt_count_sub+0x6b/0xf0 > > [] ? _raw_spin_unlock+0x31/0x50 > > [] SyS_futex+0x80/0x180 > > [] tracesys+0xdd/0xe2 I suspect this issue is at least a few months old. There hasn't been much change in rtmutexes or pi futexes lately. > This is trickier to reproduce than it first seemed, as logging slows > things down so much. But after a few hours, it logged that the > call that triggered this was.. > > futex(uaddr=0x7f55ff8c4000, op=0x6, val=0x20006223800b, > utime=0x7f55ff8c4000, uaddr2=0x7f55ff8c4000, val3=-123) Perhaps because of chance. Even for pi futexes, if the lock is uncontended, the kernel will never take part. > Those addresses come from an mmap we made on startup.. > > [init] mapping[3]: (zeropage PROT_READ | PROT_WRITE) 0x7f55ff8c4000 (1MB) > > op = FUTEX_LOCK_PI > > val seems to be garbage. > > I'll do another run, just to see if it's always the same set of values, > but it's going to probably take an overnight run. Would reverting commit c365c292d059 (sched: Consider pi boosting in setscheduler()) fix this? -- 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 v4] ARM: perf: save/restore pmu registers in pm notifier
> -Original Message- > From: Will Deacon [mailto:will.dea...@arm.com] > Sent: 2014å¹´4月24æ—¥ 1:08 > To: Neil Zhang > Cc: li...@arm.linux.org.uk; linux-arm-ker...@lists.infradead.org; > linux-kernel@vger.kernel.org; Sudeep Holla; devicet...@vger.kernel.org > Subject: Re: [PATCH v4] ARM: perf: save/restore pmu registers in pm notifier > > On Wed, Apr 23, 2014 at 11:31:09AM +0100, Neil Zhang wrote: > > > > > -Original Message- > > > From: Will Deacon [mailto:will.dea...@arm.com] > > > Sent: 2014å¹´4月22æ—¥ 18:37 > > > To: Neil Zhang > > > Cc: li...@arm.linux.org.uk; linux-arm-ker...@lists.infradead.org; > > > linux-kernel@vger.kernel.org; Sudeep Holla; > > > devicet...@vger.kernel.org > > > Subject: Re: [PATCH v4] ARM: perf: save/restore pmu registers in pm > > > notifier > > > > > > Hi Neil, > > > > > > On Tue, Apr 22, 2014 at 03:26:36AM +0100, Neil Zhang wrote: > > > > This adds core support for saving and restoring CPU PMU registers > > > > for suspend/resume support i.e. deeper C-states in cpuidle terms. > > > > This patch adds support only to ARMv7 PMU registers save/restore. > > > > It needs to be extended to xscale and ARMv6 if needed. > > > > > > > > I made this patch because DS-5 is not working on Marvell's CA7 based > SoCs. > > > > And it has consulted Sudeep KarkadaNagesha's patch set for multiple > PMUs. > > > > > > > > Thanks Will and Sudeep's suggestion to only save / restore used events. > > > > > > Whilst this is a step in the right direction, I'd still like to see > > > the save/restore predicated on something in the device-tree or > > > otherwise. Most SoCs *don't* require these registers to be preserved > > > by software, so we need a way to describe that the PMU is in a > > > power-domain where its state is lost when the CPU goes idle. > > > > > > This doesn't sound like a PMU-specific problem, so there's a > > > possibility that this has been discussed elsewhere, in the context > > > of other IP blocks > > > > > > [adding the devicetree list in case somebody there is aware of any > > > work in this area] > > > > > > > Thanks Will. > > What should I do now? > > Add a filed under PMU or waiting for somebody whether there are > > general supporting for power domain maintain. > > I think we need some input from the device-tree guys to see whether they > would object to us solving this locally (in the PMU node) or not. > Personally, I'd much prefer a general way to describe the need for > pm-notifiers, > but if that's not being looked at then we can cook something specifically for > our needs. > No input from device-tree guys :( > Will Best Regards, Neil Zhang N�r��yb�X��ǧv�^�)Þº{.n�+{zX����ܨ}ï¿½ï¿½ï¿½Æ z�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jÇ«y�m��@A�a��� 0��h���i
Re: [PATCH v4 3/7] arm64: Introduce a kernel configuration option for VA_BITS
On Tuesday, April 29, 2014 11:45 PM, Catalin Marinas wrote: > On Tue, Apr 29, 2014 at 05:59:23AM +0100, Jungseok Lee wrote: > > +config ARM64_VA_BITS > > + int "Virtual address space size" > > + range 39 39 if ARM64_4K_PAGES && ARM64_3_LEVELS > > + range 42 42 if ARM64_64K_PAGES && ARM64_2_LEVELS > > + help > > + This feature is determined by a combination of page size and > > + level of translation tables. > > OK, so you are doing the VA bits selection already. But see my other > email about setting only exposing this and hiding the number of levels > (though number of levels can be mentioned in the help). Okay. I will hide the number of levels. Best Regards Jungseok Lee -- 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] earlyprintk=efi,keep fix
earlyprintk=efi,keep will cause kernel hangs while freeing initmem like below: [2.826089] VFS: Mounted root (ext4 filesystem) readonly on device 254:2. [2.846592] devtmpfs: mounted [2.856974] Freeing unused kernel memory: 880K (817d4000 - 818b) It is caused by efi earlyprintk use __init function which will be freed later. Such as early_efi_write is marked as __init, also it will use early_ioremap which is init function as well. To fix this issue, I added one early initcall efi_ioremap_fb which will map the whole efi fb for later use. OTOH, adding a wrapper function efi_ioremap which will call early_ioremap before ioremap is available. With this patch applied efi boot ok with earlyprintk=efi,keep console=efi Signed-off-by: Dave Young --- arch/x86/platform/efi/early_printk.c | 54 +++ 1 file changed, 42 insertions(+), 12 deletions(-) --- linux-2.6.orig/arch/x86/platform/efi/early_printk.c +++ linux-2.6/arch/x86/platform/efi/early_printk.c @@ -14,8 +14,38 @@ static const struct font_desc *font; static u32 efi_x, efi_y; +static void *efi_fb; -static __init void early_efi_clear_scanline(unsigned int y) +static __init int efi_ioremap_fb(void) +{ + unsigned long base, size; + + base = boot_params.screen_info.lfb_base; + size = boot_params.screen_info.lfb_size; + efi_fb = ioremap(base, size); + + return efi_fb ? 0 : -ENOMEM; +} +early_initcall(efi_ioremap_fb); + +static __init_refok void *efi_ioremap(unsigned long start, unsigned long len) +{ + unsigned long base; + + base = boot_params.screen_info.lfb_base; + if (efi_fb) + return (efi_fb + start - base); + else + return early_ioremap(start, len); +} + +static __init_refok void efi_iounmap(void *addr, unsigned long len) +{ + if (!efi_fb) + early_iounmap(addr, len); +} + +static void early_efi_clear_scanline(unsigned int y) { unsigned long base, *dst; u16 len; @@ -23,15 +53,15 @@ static __init void early_efi_clear_scanl base = boot_params.screen_info.lfb_base; len = boot_params.screen_info.lfb_linelength; - dst = early_ioremap(base + y*len, len); + dst = efi_ioremap(base + y*len, len); if (!dst) return; memset(dst, 0, len); - early_iounmap(dst, len); + efi_iounmap(dst, len); } -static __init void early_efi_scroll_up(void) +static void early_efi_scroll_up(void) { unsigned long base, *dst, *src; u16 len; @@ -42,20 +72,20 @@ static __init void early_efi_scroll_up(v height = boot_params.screen_info.lfb_height; for (i = 0; i < height - font->height; i++) { - dst = early_ioremap(base + i*len, len); + dst = efi_ioremap(base + i*len, len); if (!dst) return; - src = early_ioremap(base + (i + font->height) * len, len); + src = efi_ioremap(base + (i + font->height) * len, len); if (!src) { - early_iounmap(dst, len); + efi_iounmap(dst, len); return; } memmove(dst, src, len); - early_iounmap(src, len); - early_iounmap(dst, len); + efi_iounmap(src, len); + efi_iounmap(dst, len); } } @@ -79,7 +109,7 @@ static void early_efi_write_char(u32 *ds } } -static __init void +static void early_efi_write(struct console *con, const char *str, unsigned int num) { struct screen_info *si; @@ -109,7 +139,7 @@ early_efi_write(struct console *con, con for (h = 0; h < font->height; h++) { unsigned int n, x; - dst = early_ioremap(base + (efi_y + h) * len, len); + dst = efi_ioremap(base + (efi_y + h) * len, len); if (!dst) return; @@ -123,7 +153,7 @@ early_efi_write(struct console *con, con s++; } - early_iounmap(dst, len); + efi_iounmap(dst, len); } num -= count; -- 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 00/27] ACPICA: 20140424 Release
ACPICA 20140424 Release Notes for kernel-resident subsystem: Implemented support to skip/ignore NULL address entries in the RSDT/XSDT. Some of these tables are known to contain a trailing NULL entry. Lv Zheng. Removed an extraneous error message for the case where there are a large number of system GPEs (> 124). This was the "32-bit FADT register is too long to convert to GAS struct" message, which is irrelevant for GPEs since the GPEx_BLK_LEN fields of the FADT are always used instead of the (limited capacity) GAS bit length. Also, several changes to ensure proper support for GPE numbers > 255, where some "GPE number" fields were 8-bits internally. Implemented and deployed additional configuration support for the public ACPICA external interfaces. Entire classes of interfaces can now be easily modified or configured out, replaced by stubbed inline functions by default. Lv Zheng. Moved all public ACPICA runtime configuration globals to the public ACPICA external interface file for convenience. Also, removed some obsolete/unused globals. See the file acpixf.h. Lv Zheng. Documentation: Added a new section to the ACPICA reference describing the maximum number of GPEs that can be supported by the FADT-defined GPEs in block zero and one. About 1200 total. See section 4.4.1 of the ACPICA reference. Example Code and Data Size: These are the sizes for the OS-independent acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Current Release: Non-Debug Version: 96.8K Code, 27.2K Data, 124.0K Total Debug Version: 189.5K Code, 79.7K Data, 269.2K Total Previous Release: Non-Debug Version: 97.0K Code, 27.2K Data, 124.2K Total Debug Version: 189.7K Code, 79.5K Data, 269.2K Total === The 20140424 ACPICA kernel-resident subsystem updates are linuxized based on the pm/linux-next branch to form this patchset. The patchset has passed the following build/boot tests. Build tests are performed as follows: 1. i386 + default + COFNIG_ACPI=y 2. i386 + allyes + CONFIG_ACPI=y 3. i386 + default + COFNIG_ACPI=n 4. i386 + allyes + CONFIG_ACPI=n 5. x86_64 + default + COFNIG_ACPI=y 6. x86_64 + allyes + CONFIG_ACPI=y 7. x86_64 + default + COFNIG_ACPI=n 8. x86_64 + allyes + CONFIG_ACPI=n Boot tests are performed as follows: 1. i386 + default + COFNIG_ACPI=y 2. x86_64 + default + COFNIG_ACPI=y Where: 1. i386: machine named as "Dell Inspiron Mini 1010" 2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC" 3. default: kernel configuration with following items enabled: All hardware drivers related to the machines of i386/x86_64 All drivers/acpi configurations All platform drivers All ACPI drivers 4 DRM drivers that implement ACPI opregion All buses with ACPI bindings All cpufreq configurations All xen configurations All ACPI table drivers 4. allyes: kernel configuration generated by allyesconfig. After applying this series, the divergence result is: 952 Lines, 33.5 Kbytes. Bob Moore (10): ACPICA: Update acpi_buffer_to_resource interface. ACPICA: Add support for LPIT table. ACPICA: Add support for _LPD and _PRP methods. ACPICA: Comment updates - no functional change. ACPICA: Back port of _PRP update. ACPICA: Back port of improvements on exception code. ACPICA: Remove extraneous error message for large number of GPEs. ACPICA: Events: Update GPE handling and initialization code. ACPICA: Comment/format update, no functional change. ACPICA: Update version to 20140424. David E. Box (1): ACPICA: Update handling of PCI ID lists. Lv Zheng (16): ACPICA: Utilities: Cleanup obsoleted global variables. ACPICA: Utilities: Deploy ACPI_DEBUGGER_EXEC for ACPI_DEBUGGER enabled code in utglobal.c. ACPICA: acpidump: Fix code issue in invoking fread in the loop. ACPICA: Update global variable definitions. No functional change. ACPICA: OSL: Move external globals from utglobal.c to acpixf.h using ACPI_INIT_GLOBAL/ACPI_GLOBAL. ACPICA: OSL: Add configurability for memory allocation macros. ACPICA: OSL: Add configurability for error message functions. ACPICA: OSL: Add configurability for debug output functions. ACPICA: OSL: Add section to collect the divergence in acpixf.h. ACPICA: OSL: Add configurability for generic external functions. ACPICA: Linux header: Add support for stubbed externals. ACPICA: acpidump: Fix truncated RSDP signature validation. ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table(). ACPICA: acpidump: Add support to force using RSDT. ACPICA: Tables: Add new mechanism to skip NULL entries in RSDT and XSDT. ACPICA: Tables: Remove old mechanism to validate if XSDT contains NULL entries. drivers/acpi/acpica/acevents.h |5 +- drivers/acpi/acpica/acglobal.h | 141 +--- drivers/acpi/acpica/aclocal.h
[PATCH 04/27] ACPICA: Update global variable definitions. No functional change.
Move all of the public globals to acpixf.h for the convenience of users. Also: Adds #ifndef/#endif conditions arround ACPI_GLOBAL and ACPI_INIT_GLOBAL definition so that OSPMs might be able to: 1. Redefine ACPI_GLOBAL/ACPI_INIT_GLOBAL into no-op, and 2. Redefine external global variables into immediates to implement stubs for them. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- drivers/acpi/acpica/acglobal.h | 134 + include/acpi/acpixf.h | 143 2 files changed, 132 insertions(+), 145 deletions(-) diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index e7d73eb..115eedc 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -44,144 +44,14 @@ #ifndef __ACGLOBAL_H__ #define __ACGLOBAL_H__ -/* - * Ensure that the globals are actually defined and initialized only once. - * - * The use of these macros allows a single list of globals (here) in order - * to simplify maintenance of the code. - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_GLOBAL(type,name) \ - extern type name; \ - type name - -#define ACPI_INIT_GLOBAL(type,name,value) \ - type name=value - -#else -#define ACPI_GLOBAL(type,name) \ - extern type name - -#define ACPI_INIT_GLOBAL(type,name,value) \ - extern type name -#endif - -#ifdef DEFINE_ACPI_GLOBALS - -/* Public globals, available from outside ACPICA subsystem */ - /* * - * Runtime configuration (static defaults that can be overriden at runtime) + * Globals related to the ACPI tables * / -/* - * Enable "slack" in the AML interpreter? Default is FALSE, and the - * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to ignore certain errors and/or bad AML constructs. - * - * Currently, these features are enabled by this flag: - * - * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond the end of an operation region - * 3) Allow access to uninitialized locals/args (auto-init to integer 0) - * 4) Allow ANY object type to be a source operand for the Store() operator - * 5) Allow unresolved references (invalid target name) in package objects - * 6) Enable warning messages for behavior that is not ACPI spec compliant - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); - -/* - * Automatically serialize all methods that create named objects? Default - * is TRUE, meaning that all non_serialized methods are scanned once at - * table load time to determine those that create named objects. Methods - * that create named objects are marked Serialized in order to prevent - * possible run-time problems if they are entered by more than one thread. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); - -/* - * Create the predefined _OSI method in the namespace? Default is TRUE - * because ACPICA is fully compatible with other ACPI implementations. - * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); - -/* - * Optionally use default values for the ACPI register widths. Set this to - * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); - -/* - * Optionally enable output from the AML Debug Object. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); - -/* - * Optionally copy the entire DSDT to local memory (instead of simply - * mapping it.) There are some BIOSs that corrupt or replace the original - * DSDT, creating the need for this option. Default is FALSE, do not copy - * the DSDT. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); - -/* - * Optionally ignore an XSDT if present and use the RSDT instead. - * Although the ACPI specification requires that an XSDT be used instead - * of the RSDT, the XSDT has been found to be corrupt or ill-formed on - * some machines. Default behavior is to use the XSDT if present. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); - -/* - * Optionally use 32-bit FADT addresses if and when there is a conflict - * (address mismatch) between the 32-bit and 64-bit versions of the - * address. Although ACPICA adheres to the ACPI specification which - * requires the use of the corresponding 64-bit address if it is non-zero, - * some machines have been found to have a corrupted non-zero 64-bit - * address. Default is FALSE, do not favor the 32-bit addresses. - */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); - -/* - * Optionally truncate I/O addresses to 16 bits. Provides compatibility - * with other ACPI implementations. NOTE: During ACPICA initialization, - * this value is set to TRUE if
[PATCH 20/27] ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table().
The commit of back porting Linux XSDT validation mechanism has introduced a regreession: Commit: 671cc68dc61f029d44b43a681356078e02d8dab8 Subject: ACPICA: Back port and refine validation of the XSDT root table. There is a pointer still accessed after unmapping. This patch fixes this issue. Lv Zheng. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=73911 Buglink: https://bugs.archlinux.org/task/39811 Signed-off-by: Lv Zheng Reported-and-tested-by: Bruce Chiarelli Reported-and-tested-by: Spyros Stathopoulos Signed-off-by: Bob Moore Cc: # 3.14.x: 671cc68: ACPICA: Back port and refine validation of the XSDT root table. --- drivers/acpi/acpica/tbutils.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 6c31d77..e1638ad 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -355,6 +355,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) u32 table_count; struct acpi_table_header *table; acpi_physical_address address; + acpi_physical_address rsdt_address; u32 length; u8 *table_entry; acpi_status status; @@ -383,11 +384,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) * as per the ACPI specification. */ address = (acpi_physical_address) rsdp->xsdt_physical_address; + rsdt_address = + (acpi_physical_address) rsdp->rsdt_physical_address; table_entry_size = ACPI_XSDT_ENTRY_SIZE; } else { /* Root table is an RSDT (32-bit physical addresses) */ address = (acpi_physical_address) rsdp->rsdt_physical_address; + rsdt_address = address; table_entry_size = ACPI_RSDT_ENTRY_SIZE; } @@ -410,8 +414,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) /* Fall back to the RSDT */ - address = - (acpi_physical_address) rsdp->rsdt_physical_address; + address = rsdt_address; table_entry_size = ACPI_RSDT_ENTRY_SIZE; } } -- 1.7.10 -- 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 26/27] ACPICA: Comment/format update, no functional change.
From: Bob Moore Add some additional commenting the the public acpixf.h file. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/acpixf.h | 73 - 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2d074ba..b3b2108 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -55,11 +55,17 @@ extern u8 acpi_gbl_permanent_mmap; +/* + * + * Macros used for ACPICA globals and configuration + * + / + /* - * Ensure that the globals are actually defined and initialized only once. + * Ensure that global variables are defined and initialized only once. * - * The use of these macros allows a single list of globals (here) in order - * to simplify maintenance of the code. + * The use of these macros allows for a single list of globals (here) + * in order to simplify maintenance of the code. */ #ifdef DEFINE_ACPI_GLOBALS #define ACPI_GLOBAL(type,name) \ @@ -81,8 +87,11 @@ extern u8 acpi_gbl_permanent_mmap; #endif #endif -/* ACPICA prototypes */ - +/* + * These macros configure the various ACPICA interfaces. They are + * useful for generating stub inline functions for features that are + * configured out of the current kernel or ACPICA application. + */ #ifndef ACPI_EXTERNAL_RETURN_STATUS #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ prototype; @@ -108,16 +117,14 @@ extern u8 acpi_gbl_permanent_mmap; prototype; #endif -/* Public globals, available from outside ACPICA subsystem */ - /* * - * Runtime configuration (static defaults that can be overriden at runtime) + * Public globals and runtime configuration options * / /* - * Enable "slack" in the AML interpreter? Default is FALSE, and the + * Enable "slack mode" of the AML interpreter? Default is FALSE, and the * interpreter strictly follows the ACPI specification. Setting to TRUE * allows the interpreter to ignore certain errors and/or bad AML constructs. * @@ -234,16 +241,34 @@ ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); /* - * Globals that are publically available + * Other miscellaneous globals */ -ACPI_GLOBAL(u32, acpi_current_gpe_count); ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT); +ACPI_GLOBAL(u32, acpi_current_gpe_count); ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); +/* + * + * ACPICA public interface configuration. + * + * Interfaces that are configured out of the ACPICA build are replaced + * by inlined stubs by default. + * + / + /* - * Hardware-reduced prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag + * Hardware-reduced prototypes (default: Not hardware reduced). + * + * All ACPICA hardware-related interfaces that use these macros will be + * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag * is set to TRUE. + * + * Note: This static build option for reduced hardware is intended to + * reduce ACPICA code size if desired or necessary. However, even if this + * option is not specified, the runtime behavior of ACPICA is dependent + * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, + * the flag will enable similar behavior -- ACPICA will not attempt + * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) */ #if (!ACPI_REDUCED_HARDWARE) #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ @@ -268,9 +293,11 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); #endif /* !ACPI_REDUCED_HARDWARE */ /* - * Error-message prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_NO_ERROR_MESSAGE flag - * is defined. + * Error message prototypes (default: error messages enabled). + * + * All interfaces related to error and warning messages + * will be configured out of the ACPICA build if the + * ACPI_NO_ERROR_MESSAGE flag is defined. */ #ifndef ACPI_NO_ERROR_MESSAGES #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ @@ -283,9 +310,11 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); #endif /* ACPI_NO_ERROR_MESSAGES */ /* - * Debugging-output prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_DEBUG_OUTPUT flag is - * not defined. + * Debugging output prototypes (default: no debug output). + * + * All interfaces related to debug output
[PATCH 09/27] ACPICA: Comment updates - no functional change.
From: Bob Moore Change all instances of "sub-table" to "subtable" for consistency. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/actbl1.h |4 ++-- include/acpi/actbl2.h |6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 212c65d..4ad7da8 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -675,7 +675,7 @@ enum acpi_madt_type { }; /* - * MADT Sub-tables, correspond to Type in struct acpi_subtable_header + * MADT Subtables, correspond to Type in struct acpi_subtable_header */ /* 0: Processor Local APIC */ @@ -918,7 +918,7 @@ enum acpi_srat_type { }; /* - * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header + * SRAT Subtables, correspond to Type in struct acpi_subtable_header */ /* 0: Processor Local APIC/SAPIC Affinity */ diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 6874261..860e5c8 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -457,7 +457,7 @@ struct acpi_dmar_pci_path { }; /* - * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header + * DMAR Subtables, correspond to Type in struct acpi_dmar_header */ /* 0: Hardware Unit Definition */ @@ -885,7 +885,7 @@ struct acpi_lpit_io { /*** * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * MCFG - PCI Memory Mapped Configuration table and subtable *Version 1 * * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 @@ -988,7 +988,7 @@ enum acpi_slic_type { }; /* - * SLIC Sub-tables, correspond to Type in struct acpi_slic_header + * SLIC Subtables, correspond to Type in struct acpi_slic_header */ /* 0: Public Key Structure */ -- 1.7.10 -- 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 17/27] ACPICA: acpidump: Fix truncated RSDP signature validation.
This patch enforces a rule to always use ACPI_VALIDATE_RSDP_SIG for RSDP signatures passed from table header or ACPI_SIG_RSDP so that truncated string comparison can be avoided. This could help to fix the issue that "RSD " matches but "RSD PTR " doesn't match. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- .../acpi/os_specific/service_layers/oslinuxtbl.c | 41 +++- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index dc65098..a8cd344 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c @@ -996,10 +996,21 @@ osl_map_table(acpi_size address, /* If specified, signature must match */ - if (signature && !ACPI_COMPARE_NAME(signature, mapped_table->signature)) { - acpi_os_unmap_memory(mapped_table, -sizeof(struct acpi_table_header)); - return (AE_BAD_SIGNATURE); + if (signature) { + if (ACPI_VALIDATE_RSDP_SIG(signature)) { + if (!ACPI_VALIDATE_RSDP_SIG(mapped_table->signature)) { + acpi_os_unmap_memory(mapped_table, +sizeof(struct + acpi_table_header)); + return (AE_BAD_SIGNATURE); + } + } else + if (!ACPI_COMPARE_NAME(signature, mapped_table->signature)) + { + acpi_os_unmap_memory(mapped_table, +sizeof(struct acpi_table_header)); + return (AE_BAD_SIGNATURE); + } } /* Map the entire table */ @@ -1135,12 +1146,22 @@ osl_read_table_from_file(char *filename, /* If signature is specified, it must match the table */ - if (signature && !ACPI_COMPARE_NAME(signature, header.signature)) { - fprintf(stderr, - "Incorrect signature: Expecting %4.4s, found %4.4s\n", - signature, header.signature); - status = AE_BAD_SIGNATURE; - goto exit; + if (signature) { + if (ACPI_VALIDATE_RSDP_SIG(signature)) { + if (!ACPI_VALIDATE_RSDP_SIG(header.signature)) { + fprintf(stderr, + "Incorrect RSDP signature: found %8.8s\n", + header.signature); + status = AE_BAD_SIGNATURE; + goto exit; + } + } else if (!ACPI_COMPARE_NAME(signature, header.signature)) { + fprintf(stderr, + "Incorrect signature: Expecting %4.4s, found %4.4s\n", + signature, header.signature); + status = AE_BAD_SIGNATURE; + goto exit; + } } table_length = ap_get_table_length(); -- 1.7.10 -- 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 27/27] ACPICA: Update version to 20140424.
From: Bob Moore Version 20140424. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/acpixf.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index b3b2108..4e3044c 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in MMDD format */ -#define ACPI_CA_VERSION 0x20140325 +#define ACPI_CA_VERSION 0x20140424 #include #include -- 1.7.10 -- 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 21/27] ACPICA: acpidump: Add support to force using RSDT.
This patch adds "-x" and "-x -x" options to disable XSDT for acpidump. The single "-x" can be used to stop using XSDT, RSDT will be forced to find static tables, note that XSDT will still be dumped. The double "-x" can stop dumping XSDT, which is useful when the XSDT address reported by RSDP is pointing to an invalid address. It is reported there are platforms having broken XSDT shipped, acpidump will stop working while accessing such XSDT. This patch adds new option so that users can force acpidump to dump tables listed in the RSDT. Lv Zheng. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=73911 Buglink: https://bugs.archlinux.org/task/39811 Signed-off-by: Lv Zheng Reported-and-tested-by: Bruce Chiarelli Reported-and-tested-by: Spyros Stathopoulos Signed-off-by: Bob Moore --- .../acpi/os_specific/service_layers/oslinuxtbl.c | 32 +--- tools/power/acpi/tools/acpidump/acpidump.h | 23 +++--- tools/power/acpi/tools/acpidump/apmain.c | 13 +++- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index a8cd344..e0699e6 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c @@ -505,6 +505,28 @@ static acpi_status osl_load_rsdp(void) /** * + * FUNCTION:osl_can_use_xsdt + * + * PARAMETERS: None + * + * RETURN: TRUE if XSDT is allowed to be used. + * + * DESCRIPTION: This function collects logic that can be used to determine if + * XSDT should be used instead of RSDT. + * + */ + +static u8 osl_can_use_xsdt(void) +{ + if (gbl_revision && !acpi_gbl_do_not_use_xsdt) { + return (TRUE); + } else { + return (FALSE); + } +} + +/** + * * FUNCTION:osl_table_initialize * * PARAMETERS: None @@ -535,7 +557,7 @@ static acpi_status osl_table_initialize(void) /* Get XSDT from memory */ - if (gbl_rsdp.revision) { + if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) { if (gbl_xsdt) { free(gbl_xsdt); gbl_xsdt = NULL; @@ -668,7 +690,7 @@ static acpi_status osl_list_bios_tables(void) acpi_status status = AE_OK; u32 i; - if (gbl_revision) { + if (osl_can_use_xsdt()) { item_size = sizeof(u64); table_data = ACPI_CAST8(gbl_xsdt) + sizeof(struct acpi_table_header); @@ -690,7 +712,7 @@ static acpi_status osl_list_bios_tables(void) /* Search RSDT/XSDT for the requested table */ for (i = 0; i < number_of_tables; ++i, table_data += item_size) { - if (gbl_revision) { + if (osl_can_use_xsdt()) { table_address = (acpi_physical_address) (*ACPI_CAST64(table_data)); } else { @@ -809,7 +831,7 @@ osl_get_bios_table(char *signature, table_length = ap_get_table_length(mapped_table); } else {/* Case for a normal ACPI table */ - if (gbl_revision) { + if (osl_can_use_xsdt()) { item_size = sizeof(u64); table_data = ACPI_CAST8(gbl_xsdt) + @@ -833,7 +855,7 @@ osl_get_bios_table(char *signature, /* Search RSDT/XSDT for the requested table */ for (i = 0; i < number_of_tables; ++i, table_data += item_size) { - if (gbl_revision) { + if (osl_can_use_xsdt()) { table_address = (acpi_physical_address) (*ACPI_CAST64 (table_data)); diff --git a/tools/power/acpi/tools/acpidump/acpidump.h b/tools/power/acpi/tools/acpidump/acpidump.h index 3361b9e..46f5195 100644 --- a/tools/power/acpi/tools/acpidump/acpidump.h +++ b/tools/power/acpi/tools/acpidump/acpidump.h @@ -41,32 +41,34 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include -#include "accommon.h" -#include "actables.h" - -#include -#include -#include -#include - /* * Global variables. Defined in main.c only, externed in all other files */ #ifdef _DECLARE_GLOBALS #define EXTERN #define INIT_GLOBAL(a,b)a=b +#define DEFINE_ACPI_GLOBALS 1 #else #define EXTERN extern #define INIT_GLOBAL(a,b)a #endif +#include +#include "accommon.h" +#include "actables.h" + +#include +#include +#include +#include + /* Globals */ EXTERN u8 INIT_GLOBAL(gbl_summary_mode,
[PATCH 25/27] ACPICA: Events: Update GPE handling and initialization code.
From: Bob Moore 1) Eliminate most use of GAS structs, since they are not needed for GPEs. 2) Allow raw GPE numbers > 255. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/acevents.h |5 +++-- drivers/acpi/acpica/aclocal.h |9 + drivers/acpi/acpica/evgpe.c | 13 +++-- drivers/acpi/acpica/evgpeblk.c | 34 -- drivers/acpi/acpica/evgpeinit.c | 12 drivers/acpi/acpica/evxfgpe.c |7 --- 6 files changed, 43 insertions(+), 37 deletions(-) diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 68ec61f..7a7811a 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h @@ -104,9 +104,10 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info); */ acpi_status acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, -struct acpi_generic_address *gpe_block_address, +u64 address, +u8 space_id, u32 register_count, -u8 gpe_block_base_number, +u16 gpe_block_base_number, u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block); diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index f68cb60..91f801a 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h @@ -450,9 +450,9 @@ struct acpi_gpe_event_info { struct acpi_gpe_register_info { struct acpi_generic_address status_address; /* Address of status reg */ struct acpi_generic_address enable_address; /* Address of enable reg */ + u16 base_gpe_number;/* Base GPE number for this register */ u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ u8 enable_for_run; /* GPEs to keep enabled when running */ - u8 base_gpe_number; /* Base GPE number for this register */ }; /* @@ -466,11 +466,12 @@ struct acpi_gpe_block_info { struct acpi_gpe_xrupt_info *xrupt_block;/* Backpointer to interrupt block */ struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ struct acpi_gpe_event_info *event_info; /* One for each GPE */ - struct acpi_generic_address block_address; /* Base address of the block */ + u64 address;/* Base address of the block */ u32 register_count; /* Number of register pairs in block */ u16 gpe_count; /* Number of individual GPEs in block */ - u8 block_base_number; /* Base GPE number for this block */ - u8 initialized; /* TRUE if this block is initialized */ + u16 block_base_number; /* Base GPE number for this block */ + u8 space_id; + u8 initialized; /* TRUE if this block is initialized */ }; /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 955f83d..48f7001 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c @@ -383,7 +383,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) if (!(gpe_register_info->enable_for_run | gpe_register_info->enable_for_wake)) { ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, - "Ignore disabled registers for GPE%02X-GPE%02X: " + "Ignore disabled registers for GPE %02X-%02X: " "RunEnable=%02X, WakeEnable=%02X\n", gpe_register_info-> base_gpe_number, @@ -416,7 +416,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) } ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, - "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " + "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, " "RunEnable=%02X, WakeEnable=%02X\n", gpe_register_info->base_gpe_number, gpe_register_info->base_gpe_number + @@ -706,7 +706,8 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, - "Unable to clear GPE%02X", gpe_number)); + "Unable to clear GPE %02X", +
[PATCH 23/27] ACPICA: Tables: Remove old mechanism to validate if XSDT contains NULL entries.
With the NULL entry sanity check implemented, the XSDT validation is useless because: 1. If XSDT contains NULL entries, it can be bypassed by the new sanity check mechanism; 2. If RSDP contains a bad XSDT address, invoking XSDT validation will still lead to a kernel crash. This patch deletes the old XSDT validation solution and thus enables the new NULL entry sanity check solution. Note that if there are reports reporting regressions caused by the enabling of the new feature and disabling of the old feature, this commit should be bisected and reverted. Lv Zheng. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=73911 Buglink: https://bugs.archlinux.org/task/39811 Signed-off-by: Lv Zheng Reported-and-tested-by: Bruce Chiarelli Reported-and-tested-by: Spyros Stathopoulos Cc: Zhao Yakui Signed-off-by: Bob Moore --- drivers/acpi/acpica/tbutils.c | 105 - 1 file changed, 105 deletions(-) diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 801d196..e37a103 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -49,8 +49,6 @@ ACPI_MODULE_NAME("tbutils") /* Local prototypes */ -static acpi_status acpi_tb_validate_xsdt(acpi_physical_address address); - static acpi_physical_address acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); @@ -251,87 +249,6 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) /*** * - * FUNCTION:acpi_tb_validate_xsdt - * - * PARAMETERS: address - Physical address of the XSDT (from RSDP) - * - * RETURN: Status. AE_OK if the table appears to be valid. - * - * DESCRIPTION: Validate an XSDT to ensure that it is of minimum size and does - * not contain any NULL entries. A problem that is seen in the - * field is that the XSDT exists, but is actually useless because - * of one or more (or all) NULL entries. - * - **/ - -static acpi_status acpi_tb_validate_xsdt(acpi_physical_address xsdt_address) -{ - struct acpi_table_header *table; - u8 *next_entry; - acpi_physical_address address; - u32 length; - u32 entry_count; - acpi_status status; - u32 i; - - /* Get the XSDT length */ - - table = - acpi_os_map_memory(xsdt_address, sizeof(struct acpi_table_header)); - if (!table) { - return (AE_NO_MEMORY); - } - - length = table->length; - acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); - - /* -* Minimum XSDT length is the size of the standard ACPI header -* plus one physical address entry -*/ - if (length < (sizeof(struct acpi_table_header) + ACPI_XSDT_ENTRY_SIZE)) { - return (AE_INVALID_TABLE_LENGTH); - } - - /* Map the entire XSDT */ - - table = acpi_os_map_memory(xsdt_address, length); - if (!table) { - return (AE_NO_MEMORY); - } - - /* Get the number of entries and pointer to first entry */ - - status = AE_OK; - next_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header)); - entry_count = (u32)((table->length - sizeof(struct acpi_table_header)) / - ACPI_XSDT_ENTRY_SIZE); - - /* Validate each entry (physical address) within the XSDT */ - - for (i = 0; i < entry_count; i++) { - address = - acpi_tb_get_root_table_entry(next_entry, -ACPI_XSDT_ENTRY_SIZE); - if (!address) { - - /* Detected a NULL entry, XSDT is invalid */ - - status = AE_NULL_ENTRY; - break; - } - - next_entry += ACPI_XSDT_ENTRY_SIZE; - } - - /* Unmap table */ - - acpi_os_unmap_memory(table, length); - return (status); -} - -/*** - * * FUNCTION:acpi_tb_parse_root_table * * PARAMETERS: rsdp- Pointer to the RSDP @@ -355,7 +272,6 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) u32 table_count; struct acpi_table_header *table; acpi_physical_address address; - acpi_physical_address rsdt_address; u32 length; u8 *table_entry; acpi_status status; @@ -384,14 +300,11 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) * as per the ACPI specification. */ address = (acpi_physical_address) rsdp->xsdt_physical_address; - rsdt_address = - (acpi_physical_address)
[PATCH 14/27] ACPICA: OSL: Add section to collect the divergence in acpixf.h.
This patch re-orders the interface prototypes defined in acpixf.h, moving those having not back ported to ACPICA into a seperate section to reduce the source code differences between Linux and ACPICA. This can help to reduce the cost of linuxizing the follow up commits. Signed-off-by: Lv Zheng --- include/acpi/acpixf.h | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 923775a..7980c87 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -338,18 +338,11 @@ acpi_status __init acpi_reallocate_root_table(void); acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address); -acpi_status acpi_unload_table_id(acpi_owner_id id); - acpi_status acpi_get_table_header(acpi_string signature, u32 instance, struct acpi_table_header *out_table_header); acpi_status -acpi_get_table_with_size(acpi_string signature, - u32 instance, struct acpi_table_header **out_table, - acpi_size *tbl_size); - -acpi_status acpi_get_table(acpi_string signature, u32 instance, struct acpi_table_header **out_table); @@ -391,10 +384,6 @@ acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data); acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); acpi_status -acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, - void (*callback)(void *)); - -acpi_status acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); acpi_status @@ -429,8 +418,6 @@ acpi_get_next_object(acpi_object_type type, acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); -acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); - acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); /* @@ -747,4 +734,21 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) const char *module_name, u32 component_id, const char *format, ...)) + +/* + * Divergences + */ +acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); + +acpi_status acpi_unload_table_id(acpi_owner_id id); + +acpi_status +acpi_get_table_with_size(acpi_string signature, + u32 instance, struct acpi_table_header **out_table, + acpi_size *tbl_size); + +acpi_status +acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, + void (*callback)(void *)); + #endif /* __ACXFACE_H__ */ -- 1.7.10 -- 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 24/27] ACPICA: Remove extraneous error message for large number of GPEs.
From: Bob Moore Fixes a problem where an extraneous error message was emitted during initialization if there is a GPE block larger than 255 bits. Any GPE block larger than 120 GPEs could generate the error. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/tbfadt.c | 51 +++--- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index a37af16..41519a9 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c @@ -52,7 +52,8 @@ ACPI_MODULE_NAME("tbfadt") static void acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 space_id, -u8 byte_width, u64 address, char *register_name); +u8 byte_width, +u64 address, char *register_name, u8 flags); static void acpi_tb_convert_fadt(void); @@ -69,13 +70,14 @@ typedef struct acpi_fadt_info { u16 address32; u16 length; u8 default_length; - u8 type; + u8 flags; } acpi_fadt_info; #define ACPI_FADT_OPTIONAL 0 #define ACPI_FADT_REQUIRED 1 #define ACPI_FADT_SEPARATE_LENGTH 2 +#define ACPI_FADT_GPE_REGISTER 4 static struct acpi_fadt_info fadt_info_table[] = { {"Pm1aEventBlock", @@ -125,14 +127,14 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_OFFSET(gpe0_block), ACPI_FADT_OFFSET(gpe0_block_length), 0, -ACPI_FADT_SEPARATE_LENGTH}, +ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}, {"Gpe1Block", ACPI_FADT_OFFSET(xgpe1_block), ACPI_FADT_OFFSET(gpe1_block), ACPI_FADT_OFFSET(gpe1_block_length), 0, -ACPI_FADT_SEPARATE_LENGTH} +ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; #define ACPI_FADT_INFO_ENTRIES \ @@ -189,19 +191,29 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { static void acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 space_id, -u8 byte_width, u64 address, char *register_name) +u8 byte_width, +u64 address, char *register_name, u8 flags) { u8 bit_width; - /* Bit width field in the GAS is only one byte long, 255 max */ - + /* +* Bit width field in the GAS is only one byte long, 255 max. +* Check for bit_width overflow in GAS. +*/ bit_width = (u8)(byte_width * 8); - - if (byte_width > 31) { /* (31*8)=248 */ - ACPI_ERROR((AE_INFO, - "%s - 32-bit FADT register is too long (%u bytes, %u bits) " - "to convert to GAS struct - 255 bits max, truncating", - register_name, byte_width, (byte_width * 8))); + if (byte_width > 31) { /* (31*8)=248, (32*8)=256 */ + /* +* No error for GPE blocks, because we do not use the bit_width +* for GPEs, the legacy length (byte_width) is used instead to +* allow for a large number of GPEs. +*/ + if (!(flags & ACPI_FADT_GPE_REGISTER)) { + ACPI_ERROR((AE_INFO, + "%s - 32-bit FADT register is too long (%u bytes, %u bits) " + "to convert to GAS struct - 255 bits max, truncating", + register_name, byte_width, + (byte_width * 8))); + } bit_width = 255; } @@ -450,6 +462,7 @@ static void acpi_tb_convert_fadt(void) struct acpi_generic_address *address64; u32 address32; u8 length; + u8 flags; u32 i; /* @@ -515,6 +528,7 @@ static void acpi_tb_convert_fadt(void) fadt_info_table[i].length); name = fadt_info_table[i].name; + flags = fadt_info_table[i].flags; /* * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" @@ -554,7 +568,7 @@ static void acpi_tb_convert_fadt(void) [i]. length), (u64)address32, -name); +name, flags); } else if (address64->address != (u64)address32) { /* Address mismatch */ @@ -582,7 +596,8 @@ static void acpi_tb_convert_fadt(void)
[PATCH 22/27] ACPICA: Tables: Add new mechanism to skip NULL entries in RSDT and XSDT.
It is reported that there are buggy BIOSes in the world: AMI uses an XSDT compiler for early BIOSes, this compiler will generate XSDT with a NULL entry. The affected BIOS versions are "AMI BIOS F2-F4". Original solution on Linux is to use an alternative heathy root table instead of the ill one. This commit is: Commit: 671cc68dc61f029d44b43a681356078e02d8dab8 Subject: ACPICA: Back port and refine validation of the XSDT root table. This is an example of such XSDT dumped from B85-HD3 (AMI F3 BIOS): [000h 4]Signature : "XSDT"[Extended System Description Table] [004h 0004 4] Table Length : 0074 [008h 0008 1] Revision : 01 [009h 0009 1] Checksum : 18 [00Ah 0010 6] Oem ID : "ALASKA" [010h 0016 8] Oem Table ID : "A M I" [018h 0024 4] Oem Revision : 01072009 [01Ch 0028 4] Asl Compiler ID : "AMI " [020h 0032 4]Asl Compiler Revision : 00010013 [024h 0036 8] ACPI Table Address 0 : BA5F8180 [02Ch 0044 8] ACPI Table Address 1 : BA5F8290 [034h 0052 8] ACPI Table Address 2 : BA5F8308 [03Ch 0060 8] ACPI Table Address 3 : BA5F8848 [044h 0068 8] ACPI Table Address 4 : BA5F9320 [04Ch 0076 8] ACPI Table Address 5 : BA5F9360 [054h 0084 8] ACPI Table Address 6 : BA5F9398 [05Ch 0092 8] ACPI Table Address 7 : BA5F9708 [064h d100 8] ACPI Table Address 8 : BA5FC9A8 [06Ch 0108 8] ACPI Table Address 9 : But according to the bug report, the XSDT in fact is not broken. In the above XSDT, ACPI Table Address 1-8 contains the same value as RSDT. The differences can only be seen on the following 2 entries: 1. The first entry points to a FADT whose Revision is 5 while the first entry in RSDT points to a FADT whose Revision is 2. The FADT dumped from the address indicated by the first entry of XSDT: FACP @ 0xBA5F8180 : 46 41 43 50 0C 01 00 00<05>4B 41 4C 41 53 4B 41 FACP.KALASKA ... The FADT dumped from the address indicated by the first entry of RSDT: FACP @ 0xBA5ED0F0 : 46 41 43 50 84 00 00 00<02>A7 41 4C 41 53 4B 41 FACP..ALASKA ... 2. The last entry is a NULL terminator. According to the test result, the Revision 5 FADT is accessible. Thus the original solution turns out to be a work around that is preventing the higher revision tables to be used for such platforms (they are all x86-64 platforms, and should use XSDT and higher revision FADT). This patch offers a new solution, where a sanity check is performed before installing a table address from XSDT. If the entry is NULL, it is simply discarded. Note that, this patch doesn't remove the original solution, so for Linux kernel, this commit is actually a no-op, but it allows acpidump to be working on such platforms. By doing so, we allow another easy revertable commit to enable this feature so that when that commit is reverted, the useful sanity check will not be affected. Lv Zheng. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=73911 Buglink: https://bugs.archlinux.org/task/39811 Signed-off-by: Lv Zheng Reported-and-tested-by: Bruce Chiarelli Reported-and-tested-by: Spyros Stathopoulos Cc: Zhao Yakui Signed-off-by: Bob Moore --- drivers/acpi/acpica/tbutils.c | 21 ++-- .../acpi/os_specific/service_layers/oslinuxtbl.c | 12 +++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index e1638ad..801d196 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -474,12 +474,19 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ - status = - acpi_tb_install_standard_table(acpi_tb_get_root_table_entry - (table_entry, - table_entry_size), - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, - FALSE, TRUE, _index); + address = + acpi_tb_get_root_table_entry(table_entry, table_entry_size); + + /* Skip NULL entries in RSDT/XSDT */ + + if (!address) { + goto next_table; + } + + status = acpi_tb_install_standard_table(address, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, + FALSE, TRUE, +
[PATCH 19/27] ACPICA: Back port of improvements on exception code.
From: Bob Moore This is the linuxize result of the following commit: Subject: ACPICA: Improve handling of exception code blocks. Split exception codes into three distinct blocks; for the main ASL compiler, Table compiler, and the preprocessor. This allows easy addition of new codes into each block without disturbing the others. Adds one new file, aslmessages.c The iASL changes are not in this patch as iASL currently is not shipped in the kernel. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/acpixf.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index ac04985..2d074ba 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -207,7 +207,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); /* * We keep track of the latest version of Windows that has been requested by - * the BIOS. ACPI 5.0. + * the BIOS. ACPI 5.0. */ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); -- 1.7.10 -- 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 18/27] ACPICA: Back port of _PRP update.
From: Bob Moore This patch is the linuxize result of the following commit: Subject: ACPICA: Add check for _PRP/_HID dependency, with error message. _PRP requires that a _HID appears in the same scope. The iASL changes are not in this patch as iASL currently is not shipped in the kernel. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/acnames.h |1 + 1 file changed, 1 insertion(+) diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 3dd6e83..f0e713f 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -55,6 +55,7 @@ #define METHOD_NAME__HID"_HID" #define METHOD_NAME__INI"_INI" #define METHOD_NAME__PLD"_PLD" +#define METHOD_NAME__PRP"_PRP" #define METHOD_NAME__PRS"_PRS" #define METHOD_NAME__PRT"_PRT" #define METHOD_NAME__PRW"_PRW" -- 1.7.10 -- 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 16/27] ACPICA: Linux header: Add support for stubbed externals.
Linux wants to include all header files but leave empty inline stub variables for a feature that is not configured during build. This patch configures ACPICA external globals/macros/functions out and defines them into no-op when CONFIG_ACPI is not enabled. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- include/acpi/platform/aclinux.h | 31 +++ 1 file changed, 31 insertions(+) diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index f242909..4c2f9e7 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -73,6 +73,37 @@ #endif #include +#ifndef CONFIG_ACPI + +/* External globals for __KERNEL__, stubs is needed */ + +#define ACPI_GLOBAL(t,a) +#define ACPI_INIT_GLOBAL(t,a,b) + +/* Generating stubs for configurable ACPICA macros */ + +#define ACPI_NO_MEM_ALLOCATIONS + +/* Generating stubs for configurable ACPICA functions */ + +#define ACPI_NO_ERROR_MESSAGES +#undef ACPI_DEBUG_OUTPUT + +/* External interface for __KERNEL__, stub is needed */ + +#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ + static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} +#define ACPI_EXTERNAL_RETURN_OK(prototype) \ + static ACPI_INLINE prototype {return(AE_OK);} +#define ACPI_EXTERNAL_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} +#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ + static ACPI_INLINE prototype {return(0);} +#define ACPI_EXTERNAL_RETURN_PTR(prototype) \ + static ACPI_INLINE prototype {return(NULL);} + +#endif /* CONFIG_ACPI */ + /* Host-dependent types and defines for in-kernel ACPICA */ #define ACPI_MACHINE_WIDTH BITS_PER_LONG -- 1.7.10 -- 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 12/27] ACPICA: OSL: Add configurability for error message functions.
This patch extends ACPI_HW_DEPENDENT_x mechanism to all error message related functions so that the OSPMs can have full control to configure them into stub functions. This patch doesn't include code for Linux to use this new mechanism, thus no functional change. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- drivers/acpi/acpica/utxferror.c |2 ++ include/acpi/acpixf.h | 73 --- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index edd8611..88ef77f 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c @@ -53,6 +53,7 @@ ACPI_MODULE_NAME("utxferror") * This module is used for the in-kernel ACPICA as well as the ACPICA * tools/applications. */ +#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ /*** * * FUNCTION:acpi_error @@ -249,3 +250,4 @@ acpi_bios_warning(const char *module_name, } ACPI_EXPORT_SYMBOL(acpi_bios_warning) +#endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 8255689..39f432e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -241,6 +241,21 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); #endif /* !ACPI_REDUCED_HARDWARE */ /* + * Error-message prototypes. All interfaces that use these macros will + * be configured out of the ACPICA build if the ACPI_NO_ERROR_MESSAGE flag + * is defined. + */ +#ifndef ACPI_NO_ERROR_MESSAGES +#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ + prototype; + +#else +#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} + +#endif /* ACPI_NO_ERROR_MESSAGES */ + +/* * Initialization */ acpi_status __init @@ -666,38 +681,42 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status /* * Error/Warning output */ -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -acpi_error(const char *module_name, u32 line_number, const char *format, ...); - -ACPI_PRINTF_LIKE(4) -void ACPI_INTERNAL_VAR_XFACE -acpi_exception(const char *module_name, - u32 line_number, acpi_status status, const char *format, ...); - -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -acpi_warning(const char *module_name, u32 line_number, const char *format, ...); - -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -acpi_info(const char *module_name, u32 line_number, const char *format, ...); - -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -acpi_bios_error(const char *module_name, - u32 line_number, const char *format, ...); - -ACPI_PRINTF_LIKE(3) -void ACPI_INTERNAL_VAR_XFACE -acpi_bios_warning(const char *module_name, - u32 line_number, const char *format, ...); +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) + void ACPI_INTERNAL_VAR_XFACE + acpi_error(const char *module_name, + u32 line_number, + const char *format, ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4) + void ACPI_INTERNAL_VAR_XFACE + acpi_exception(const char *module_name, + u32 line_number, + acpi_status status, + const char *format, ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) + void ACPI_INTERNAL_VAR_XFACE + acpi_warning(const char *module_name, +u32 line_number, +const char *format, ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) + void ACPI_INTERNAL_VAR_XFACE + acpi_info(const char *module_name, + u32 line_number, + const char *format, ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) + void ACPI_INTERNAL_VAR_XFACE + acpi_bios_error(const char *module_name, + u32 line_number, + const char *format, ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) + void ACPI_INTERNAL_VAR_XFACE + acpi_bios_warning(const char *module_name, + u32 line_number, + const char *format, ...)) /* * Debug output */ #ifdef ACPI_DEBUG_OUTPUT - ACPI_PRINTF_LIKE(6) void
[PATCH 13/27] ACPICA: OSL: Add configurability for debug output functions.
This patch extends ACPI_HW_DEPENDENT_x mechanism to all debugging output related functions so that the OSPMs can have full control to configure them into stub functions. This patch doesn't include code for Linux to use this new mechanism, thus no functional change. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- include/acpi/acpixf.h | 49 +++-- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 39f432e..923775a 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -256,6 +256,21 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); #endif /* ACPI_NO_ERROR_MESSAGES */ /* + * Debugging-output prototypes. All interfaces that use these macros will + * be configured out of the ACPICA build if the ACPI_DEBUG_OUTPUT flag is + * not defined. + */ +#ifdef ACPI_DEBUG_OUTPUT +#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ + prototype; + +#else +#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} + +#endif /* ACPI_DEBUG_OUTPUT */ + +/* * Initialization */ acpi_status __init @@ -716,22 +731,20 @@ ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) /* * Debug output */ -#ifdef ACPI_DEBUG_OUTPUT -ACPI_PRINTF_LIKE(6) -void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print(u32 requested_debug_level, -u32 line_number, -const char *function_name, -const char *module_name, -u32 component_id, const char *format, ...); - -ACPI_PRINTF_LIKE(6) -void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print_raw(u32 requested_debug_level, -u32 line_number, -const char *function_name, -const char *module_name, -u32 component_id, const char *format, ...); -#endif - +ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) + void ACPI_INTERNAL_VAR_XFACE + acpi_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + const char *module_name, + u32 component_id, + const char *format, ...)) +ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) + void ACPI_INTERNAL_VAR_XFACE + acpi_debug_print_raw(u32 requested_debug_level, +u32 line_number, +const char *function_name, +const char *module_name, +u32 component_id, +const char *format, ...)) #endif /* __ACXFACE_H__ */ -- 1.7.10 -- 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 15/27] ACPICA: OSL: Add configurability for generic external functions.
OSPMs like Linux trend to include all header files but leave empty inline stub functions for a feature that is not configured during build. This patch adds wrappers mechanism to be used around ACPICA external interfaces to facilitate OSPM with such configurability. This patch doesn't include code for Linux to use this new mechanism, thus no functional change. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- include/acpi/acpixf.h | 483 + 1 file changed, 283 insertions(+), 200 deletions(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 7980c87..ac04985 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -81,6 +81,33 @@ extern u8 acpi_gbl_permanent_mmap; #endif #endif +/* ACPICA prototypes */ + +#ifndef ACPI_EXTERNAL_RETURN_STATUS +#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ + prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_OK +#define ACPI_EXTERNAL_RETURN_OK(prototype) \ + prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_VOID +#define ACPI_EXTERNAL_RETURN_VOID(prototype) \ + prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_UINT32 +#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ + prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_PTR +#define ACPI_EXTERNAL_RETURN_PTR(prototype) \ + prototype; +#endif + /* Public globals, available from outside ACPICA subsystem */ /* @@ -220,13 +247,13 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); */ #if (!ACPI_REDUCED_HARDWARE) #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ - prototype; + ACPI_EXTERNAL_RETURN_STATUS(prototype) #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ - prototype; + ACPI_EXTERNAL_RETURN_OK(prototype) #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ - prototype; + ACPI_EXTERNAL_RETURN_VOID(prototype) #else #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ @@ -273,17 +300,18 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); /* * Initialization */ -acpi_status __init -acpi_initialize_tables(struct acpi_table_desc *initial_storage, - u32 initial_table_count, u8 allow_resize); - -acpi_status __init acpi_initialize_subsystem(void); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_initialize_tables(struct acpi_table_desc + *initial_storage, + u32 initial_table_count, + u8 allow_resize)) +ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void)) -acpi_status __init acpi_enable_subsystem(u32 flags); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags)) -acpi_status __init acpi_initialize_objects(u32 flags); - -acpi_status __init acpi_terminate(void); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_initialize_objects(u32 flags)) +ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void)) /* * Miscellaneous global interfaces @@ -291,145 +319,170 @@ acpi_status __init acpi_terminate(void); ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) #ifdef ACPI_FUTURE_USAGE -acpi_status acpi_subsystem_status(void); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void)) #endif #ifdef ACPI_FUTURE_USAGE -acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_system_info(struct acpi_buffer +*ret_buffer)) #endif - -acpi_status acpi_get_statistics(struct acpi_statistics *stats); - -const char *acpi_format_exception(acpi_status exception); - -acpi_status acpi_purge_cached_objects(void); - -acpi_status acpi_install_interface(acpi_string interface_name); - -acpi_status acpi_remove_interface(acpi_string interface_name); - -acpi_status acpi_update_interfaces(u8 action); - -u32 -acpi_check_address_range(acpi_adr_space_type space_id, -acpi_physical_address address, -acpi_size length, u8 warn); - -acpi_status -acpi_decode_pld_buffer(u8 *in_buffer, - acpi_size length, struct acpi_pld_info **return_buffer); +ACPI_EXTERNAL_RETURN_STATUS(acpi_status +acpi_get_statistics(struct acpi_statistics *stats)) +ACPI_EXTERNAL_RETURN_PTR(const char + *acpi_format_exception(acpi_status exception)) +ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void)) + +ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_install_interface(acpi_string interface_name)) + +ACPI_EXTERNAL_RETURN_STATUS(acpi_status +
[PATCH 11/27] ACPICA: OSL: Add configurability for memory allocation macros.
OSPMs like Linux trend to include all header files but leave empty stub macros for a feature that is not configured during build. For macros defined without other symbols referencesd it is safe to leave them without protections. By investigation, there are only the following internal/external symbols referenced by the ACPICA macros: 1. C library symbols, including string, ctype, stdarg APIs. Since such symbols are always accessbile in the kernel source tree, it is safe to leave macros referencing them without protected for Linux. 2. ACPICA OSL symbols, such symbols are designed to be used only by ACPICA internal APIs. And there are macros directly referencing mutex and memory allocation OSL symbols. We need to examine the external usages of such macros. For macros referencing the mutex OSL symbols, fortunately, there is no external user directly invoking such macros. !! IMPORTANT !! For macros referencing memory allocation OSL symbols - 1. 'free' - ACPI_FREE 2. 'alloc' - ACPI_ALLOCATE, ACPI_ALLOCATE_ZEROED, ACPI_ALLOCATE_BUFFER, ACPI_ALLOCATE_LOCAL_BUFFER there are external users directly invoking 'alloc' macros. And the more complicated situation is the reversals of such macros are not ACPI_FREE but acpi_os_free (or kfree) in Linux. Though we can define such macros into no-op, we in fact cannot define their reversals into no-op. This patch adds mechanism to protect ACPICA memory allocation APIs for Linux so that acpi_os_free (or kfree) invoked in Linux can have a zero address returned by 'alloc' macros to free. In this way, acpi_os_free (or kfree) can be converted into no-op. 3. ACPI_OFFSET and other macros that would access structure members, we need to check if such structure members are not accessible under a specific configuration. Fortunately, currently Linux doesn't use such structure members when CONFIG_ACPI is disabled. This patch thus only adds mechanism useful for implementing stubs for ACPICA provided macros - the configurability of memory allocation APIs. This patch doesn't include code for Linux to use this new mechanism, thus no functional changes. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- include/acpi/actypes.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index e763565..19b26bb 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -329,6 +329,15 @@ typedef u32 acpi_physical_address; * **/ +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE(a)NULL +#define ACPI_ALLOCATE_ZEROED(a) NULL +#define ACPI_FREE(a) +#define ACPI_MEM_TRACKING(a) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + #ifdef ACPI_DBG_TRACK_ALLOCATIONS /* * Memory allocation tracking (used by acpi_exec to detect memory leaks) @@ -350,6 +359,8 @@ typedef u32 acpi_physical_address; #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +#endif /* ACPI_NO_MEM_ALLOCATIONS */ + /** * * ACPI Specification constants (Do not change unless the specification changes) @@ -928,9 +939,19 @@ struct acpi_object_list { * Miscellaneous common Data Structures used by the interfaces */ #define ACPI_NO_BUFFER 0 + +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE_BUFFER(acpi_size) (0) +#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (0) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + #define ACPI_ALLOCATE_BUFFER(acpi_size) (-1) /* Let ACPICA allocate buffer */ #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */ +#endif /* ACPI_NO_MEM_ALLOCATIONS */ + struct acpi_buffer { acpi_size length; /* Length in bytes of the buffer */ void *pointer; /* pointer to buffer */ -- 1.7.10 -- 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/27] ACPICA: Update handling of PCI ID lists.
From: "David E. Box" More of a style cleanup. if hw_build_pci_list is to return a non-zero status, it now deletes any partial ID list that has been constructed. if it returns AE_OK, the caller is responsible for list deletion. David Box. Signed-off-by: David E. Box Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/hwpci.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c index e701d8c..6aade8e 100644 --- a/drivers/acpi/acpica/hwpci.c +++ b/drivers/acpi/acpica/hwpci.c @@ -140,11 +140,12 @@ acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, /* Walk the list, updating the PCI device/function/bus numbers */ status = acpi_hw_process_pci_list(pci_id, list_head); - } - /* Always delete the list */ + /* Delete the list */ + + acpi_hw_delete_pci_list(list_head); + } - acpi_hw_delete_pci_list(list_head); return_ACPI_STATUS(status); } @@ -187,6 +188,10 @@ acpi_hw_build_pci_list(acpi_handle root_pci_device, while (1) { status = acpi_get_parent(current_device, _device); if (ACPI_FAILURE(status)) { + + /* Must delete the list before exit */ + + acpi_hw_delete_pci_list(*return_list_head); return (status); } @@ -199,6 +204,10 @@ acpi_hw_build_pci_list(acpi_handle root_pci_device, list_element = ACPI_ALLOCATE(sizeof(struct acpi_pci_device)); if (!list_element) { + + /* Must delete the list before exit */ + + acpi_hw_delete_pci_list(*return_list_head); return (AE_NO_MEMORY); } -- 1.7.10 -- 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 10/27] ACPICA: OSL: Move external globals from utglobal.c to acpixf.h using ACPI_INIT_GLOBAL/ACPI_GLOBAL.
OSPMs like Linux trend to include all header files but leave empty stub macros for a feature that is not configured during build. This patch cleans up global variables that are defined in utglobal.c using ACPI_INIT_GLOBAL mechanism. In Linux, such global variables are used by the subsystems external to ACPICA. This patch also cleans up global variables that are defined in utglobal.c using ACPI_GLOBAL mechanism. In Linux, such global variables are not used or should not be used by the subsystems external to ACPICA. External global variables can be redefined by OSPMs using ACPI_INIT_GLOBAL/ACPI_GLOBAL macros. Thus the ACPI_GLOBAL/ACPI_INIT_GLOBAL mechanisms can be used by OSPM to implement stubs for such external globals. This patch doesn't include code for Linux to use this new mechanism, thus no functional changes. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- drivers/acpi/acpica/utglobal.c | 22 -- include/acpi/acpixf.h | 35 +++ 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 825b064..d69be3c 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c @@ -55,28 +55,7 @@ ACPI_MODULE_NAME("utglobal") * Static global variable initialization. * **/ -/* Debug output control masks */ -u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; - -u32 acpi_dbg_layer = 0; - -/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ - -struct acpi_table_fadt acpi_gbl_FADT; -u32 acpi_gbl_trace_flags; -acpi_name acpi_gbl_trace_method_name; -u8 acpi_gbl_system_awake_and_running; -u32 acpi_current_gpe_count; - -/* - * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning - * that the ACPI hardware is no longer required. A flag in the FADT indicates - * a reduced HW machine, and that flag is duplicated here for convenience. - */ -u8 acpi_gbl_reduced_hardware; - /* Various state name strings */ - const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { "\\_S0_", "\\_S1_", @@ -337,7 +316,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_last_owner_id_index = 0; acpi_gbl_next_owner_id_offset = 0; - acpi_gbl_trace_method_name = 0; acpi_gbl_trace_dbg_level = 0; acpi_gbl_trace_dbg_layer = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 010816e..8255689 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -185,22 +185,33 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); /* - * Other miscellaneous public globals + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. */ -extern u32 acpi_current_gpe_count; -extern struct acpi_table_fadt acpi_gbl_FADT; -extern u8 acpi_gbl_system_awake_and_running; -extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ +ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); -/* Runtime configuration of debug print levels */ - -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; +/* + * This mechanism is used to trace a specified AML method. The method is + * traced each time it is executed. + */ +ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0); +ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0); -/* ACPICA runtime options */ +/* + * Runtime configuration of debug output control masks. We want the debug + * switches statically initialized so they are already set when the debugger + * is entered. + */ +ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); +ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); -extern u32 acpi_gbl_trace_flags; -extern acpi_name acpi_gbl_trace_method_name; +/* + * Globals that are publically available + */ +ACPI_GLOBAL(u32, acpi_current_gpe_count); +ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT); +ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); /* * Hardware-reduced prototypes. All interfaces that use these macros will -- 1.7.10 -- 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/27] ACPICA: Add support for _LPD and _PRP methods.
From: Bob Moore This patch currently only affects acpihelp and iASL which are not shipped in the Linux kernel. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/acpredef.h |4 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index a48d713..34001a9 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h @@ -586,6 +586,10 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = { {{"_LID", METHOD_0ARGS, METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, + {{"_LPD", METHOD_0ARGS, + METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ + PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0), + {{"_MAT", METHOD_0ARGS, METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, -- 1.7.10 -- 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 06/27] ACPICA: Add support for LPIT table.
From: Bob Moore Adds header, disassembler, table compiler, and template support for the Low Power Idle Table (LPIT). Note that the disassembler and table compiler are not shipped in the kernel. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- include/acpi/actbl2.h | 65 + 1 file changed, 65 insertions(+) diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index c8adad9..6874261 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -70,6 +70,7 @@ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ +#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ @@ -820,6 +821,70 @@ struct acpi_ivrs_memory { /*** * + * LPIT - Low Power Idle Table + * + * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" + * + **/ + +struct acpi_table_lpit { + struct acpi_table_header header;/* Common ACPI table header */ +}; + +/* LPIT subtable header */ + +struct acpi_lpit_header { + u32 type; /* Subtable type */ + u32 length; /* Subtable length */ + u16 unique_id; + u16 reserved; + u32 flags; +}; + +/* Values for subtable Type above */ + +enum acpi_lpit_type { + ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, + ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 +}; + +/* Masks for Flags field above */ + +#define ACPI_LPIT_STATE_DISABLED(1) +#define ACPI_LPIT_NO_COUNTER(1<<1) + +/* + * LPIT subtables, correspond to Type in struct acpi_lpit_header + */ + +/* 0x00: Native C-state instruction based LPI structure */ + +struct acpi_lpit_native { + struct acpi_lpit_header header; + struct acpi_generic_address entry_trigger; + u32 residency; + u32 latency; + struct acpi_generic_address residency_counter; + u64 counter_frequency; +}; + +/* 0x01: Simple I/O based LPI structure */ + +struct acpi_lpit_io { + struct acpi_lpit_header header; + struct acpi_generic_address entry_trigger; + u32 trigger_action; + u64 trigger_value; + u64 trigger_mask; + struct acpi_generic_address minimum_idle_state; + u32 residency; + u32 latency; + struct acpi_generic_address residency_counter; + u64 counter_frequency; +}; + +/*** + * * MCFG - PCI Memory Mapped Configuration table and sub-table *Version 1 * -- 1.7.10 -- 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 01/27] ACPICA: Utilities: Cleanup obsoleted global variables.
This patch deletes global variable declarations that are no longer used by ACPICA. No functional changes. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- drivers/acpi/acpica/acglobal.h |7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 1f60290..e7d73eb 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -279,7 +279,6 @@ ACPI_GLOBAL(acpi_exception_handler, acpi_gbl_exception_handler); ACPI_GLOBAL(acpi_init_handler, acpi_gbl_init_handler); ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler); ACPI_GLOBAL(void *, acpi_gbl_table_handler_context); -ACPI_GLOBAL(struct acpi_walk_state *, acpi_gbl_breakpoint_walk); ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler); ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list); @@ -296,7 +295,6 @@ ACPI_GLOBAL(u8, acpi_gbl_reg_methods_executed); /* Misc */ ACPI_GLOBAL(u32, acpi_gbl_original_mode); -ACPI_GLOBAL(u32, acpi_gbl_rsdp_original_location); ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count); ACPI_GLOBAL(u32, acpi_gbl_ps_find_count); ACPI_GLOBAL(u16, acpi_gbl_pm1_enable_register_save); @@ -483,11 +481,6 @@ ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); ACPI_GLOBAL(u32, acpi_gbl_num_nodes); ACPI_GLOBAL(u32, acpi_gbl_num_objects); -ACPI_GLOBAL(u32, acpi_gbl_size_of_parse_tree); -ACPI_GLOBAL(u32, acpi_gbl_size_of_method_trees); -ACPI_GLOBAL(u32, acpi_gbl_size_of_node_entries); -ACPI_GLOBAL(u32, acpi_gbl_size_of_acpi_objects); - #endif /* ACPI_DEBUGGER */ /* -- 1.7.10 -- 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/27] ACPICA: Utilities: Deploy ACPI_DEBUGGER_EXEC for ACPI_DEBUGGER enabled code in utglobal.c.
This patch deploys ACPI_DEBUGGER_EXEC usage to utglobal.c to reduce "ifdef" of ACPI_DEBUGGER. No functional changes. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- drivers/acpi/acpica/utglobal.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index f3abeae..825b064 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c @@ -377,9 +377,7 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_disable_mem_tracking = FALSE; #endif -#ifdef ACPI_DEBUGGER - acpi_gbl_db_terminate_threads = FALSE; -#endif + ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE); return_ACPI_STATUS(AE_OK); } -- 1.7.10 -- 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 03/27] ACPICA: acpidump: Fix code issue in invoking fread in the loop.
This patch fixes an issue that the while loop is not needed as fread() should return exact the bytes of expected. The patch is tested by runing diff against the output of "-c" mode and the normal mode, and only finds the following differences: 1. table addresses: the "-c" mode will always fill 0x for the address. 2. RSDP/RSDT/XSDT: there is no generation of such tables for "-c" mode. So the test result shows the fix is valid. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- .../acpi/os_specific/service_layers/oslinuxtbl.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index e975aa9..dc65098 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c @@ -1112,7 +1112,6 @@ osl_read_table_from_file(char *filename, struct acpi_table_header *local_table = NULL; u32 table_length; s32 count; - u32 total = 0; acpi_status status = AE_OK; /* Open the file */ @@ -1163,16 +1162,12 @@ osl_read_table_from_file(char *filename, fseek(table_file, file_offset, SEEK_SET); - while (!feof(table_file) && total < table_length) { - count = fread(local_table + total, 1, table_length - total, table_file); - if (count < 0) { - fprintf(stderr, "%4.4s: Could not read table content\n", - header.signature); - status = AE_INVALID_TABLE_LENGTH; - goto exit; - } - - total += count; + count = fread(local_table, 1, table_length, table_file); + if (count != table_length) { + fprintf(stderr, "%4.4s: Could not read table content\n", + header.signature); + status = AE_INVALID_TABLE_LENGTH; + goto exit; } /* Validate checksum */ -- 1.7.10 -- 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/27] ACPICA: Update acpi_buffer_to_resource interface.
From: Bob Moore 1) Add standard trace mechanism. 2) Add ACPI_EXPORT_SYMBOL macro. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/rscreate.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 75d3690..049d9c2 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c @@ -72,6 +72,8 @@ acpi_buffer_to_resource(u8 *aml_buffer, void *resource; void *current_resource_ptr; + ACPI_FUNCTION_TRACE(acpi_buffer_to_resource); + /* * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag * is not required here. @@ -85,7 +87,7 @@ acpi_buffer_to_resource(u8 *aml_buffer, status = AE_OK; } if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } /* Allocate a buffer for the converted resource */ @@ -93,7 +95,7 @@ acpi_buffer_to_resource(u8 *aml_buffer, resource = ACPI_ALLOCATE_ZEROED(list_size_needed); current_resource_ptr = resource; if (!resource) { - return (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* Perform the AML-to-Resource conversion */ @@ -110,9 +112,11 @@ acpi_buffer_to_resource(u8 *aml_buffer, *resource_ptr = resource; } - return (status); + return_ACPI_STATUS(status); } +ACPI_EXPORT_SYMBOL(acpi_buffer_to_resource) + /*** * * FUNCTION:acpi_rs_create_resource_list @@ -130,10 +134,9 @@ acpi_buffer_to_resource(u8 *aml_buffer, * of device resources. * **/ - acpi_status acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, -struct acpi_buffer * output_buffer) +struct acpi_buffer *output_buffer) { acpi_status status; -- 1.7.10 -- 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/