lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141103145055.GA27387@pd.tnic>
Date:	Mon, 3 Nov 2014 15:50:56 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	jiang.liu@...ux.intel.com, hpa@...or.com, bhelgaas@...gle.com,
	rjw@...ysocki.net, rdunlap@...radead.org, mingo@...nel.org,
	joro@...tes.org, tglx@...utronix.de, tony.luck@...el.com,
	konrad.wilk@...cle.com, gregkh@...uxfoundation.org,
	benh@...nel.crashing.org, yinghai@...nel.org,
	linux-kernel@...r.kernel.org
Cc:	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/apic] x86, PCI, ACPI: Kill private function
 resource_to_addr() in arch/x86/pci/acpi.c

On Mon, Nov 03, 2014 at 02:57:31AM -0800, tip-bot for Jiang Liu wrote:
> Commit-ID:  e22ce93870deae0e9a54e1539f0088538f187780
> Gitweb:     http://git.kernel.org/tip/e22ce93870deae0e9a54e1539f0088538f187780
> Author:     Jiang Liu <jiang.liu@...ux.intel.com>
> AuthorDate: Mon, 27 Oct 2014 13:21:34 +0800
> Committer:  Thomas Gleixner <tglx@...utronix.de>
> CommitDate: Mon, 3 Nov 2014 11:56:07 +0100
> 
> x86, PCI, ACPI: Kill private function resource_to_addr() in arch/x86/pci/acpi.c
> 
> Private function resource_to_addr() is used to parse ACPI resources
> for PCI host bridge. There are public interfaces available for that
> purpose, so replace resource_to_addr() with public interfaces.
> 
> Signed-off-by: Jiang Liu <jiang.liu@...ux.intel.com>
> Reviewed-by: Bjorn Helgaas <bhelgaas@...gle.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: Tony Luck <tony.luck@...el.com>
> Cc: Joerg Roedel <joro@...tes.org>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Rafael J. Wysocki <rjw@...ysocki.net>
> Cc: Randy Dunlap <rdunlap@...radead.org>
> Cc: Yinghai Lu <yinghai@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Link: http://lkml.kernel.org/r/1414387308-27148-5-git-send-email-jiang.liu@linux.intel.com
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---

...

>  static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
>  {
>  	struct pci_root_info *info = data;
> -	struct resource *res;
> -	struct acpi_resource_address64 addr;
> -	acpi_status status;
> -	unsigned long flags;
> -	u64 start, orig_end, end;
> +	u64 translation_offset = 0;
> +	struct resource r = {
> +		.flags = 0
> +	};
> +
> +	if (acpi_dev_resource_memory(acpi_res, &r)) {
> +		r.flags &= IORESOURCE_MEM | IORESOURCE_IO;
> +	} else if (acpi_dev_resource_address_space(acpi_res, &r)) {
> +		u64 orig_end;
> +		struct acpi_resource_address64 addr;
> +
> +		r.flags &= IORESOURCE_MEM | IORESOURCE_IO;
> +		if (r.flags == 0)
> +			return AE_OK;
>  
> -	status = resource_to_addr(acpi_res, &addr);
> -	if (!ACPI_SUCCESS(status))
> -		return AE_OK;
> +		if (ACPI_FAILURE(acpi_resource_to_address64(acpi_res, &addr)))
> +			return AE_OK;
>  
> -	if (addr.resource_type == ACPI_MEMORY_RANGE) {
> -		flags = IORESOURCE_MEM;
> -		if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
> -			flags |= IORESOURCE_PREFETCH;
> -	} else if (addr.resource_type == ACPI_IO_RANGE) {
> -		flags = IORESOURCE_IO;
> -	} else
> -		return AE_OK;
> +		if (addr.resource_type == ACPI_MEMORY_RANGE &&
> +		    addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
> +			r.flags |= IORESOURCE_PREFETCH;
>  
> -	start = addr.minimum + addr.translation_offset;
> -	orig_end = end = addr.maximum + addr.translation_offset;
> +		translation_offset = addr.translation_offset;
> +		orig_end = r.end;
> +		r.start += translation_offset;
> +		r.end += translation_offset;
>  
> -	/* Exclude non-addressable range or non-addressable portion of range */
> -	end = min(end, (u64)iomem_resource.end);
> -	if (end <= start) {
> -		dev_info(&info->bridge->dev,
> -			"host bridge window [%#llx-%#llx] "
> -			"(ignored, not CPU addressable)\n", start, orig_end);
> -		return AE_OK;
> -	} else if (orig_end != end) {
> -		dev_info(&info->bridge->dev,
> -			"host bridge window [%#llx-%#llx] "
> -			"([%#llx-%#llx] ignored, not CPU addressable)\n", 
> -			start, orig_end, end + 1, orig_end);
> +		/* Exclude non-addressable range or non-addressable portion of range */
> +		r.end = min(r.end, iomem_resource.end);
> +		if (r.end <= r.start) {
> +			dev_info(&info->bridge->dev,
> +				"host bridge window [%#llx-%#llx] (ignored, not CPU addressable)\n",
> +				 r.start, orig_end);
> +			return AE_OK;
> +		} else if (orig_end != r.end) {
> +			dev_info(&info->bridge->dev,
> +				"host bridge window [%#llx-%#llx] ([%#llx-%#llx] ignored, not CPU addressable)\n",
> +				r.start, orig_end, r.end + 1, orig_end);
> +		}

I see the warnings below on 32-bit, those resource_size_t things on
32-bit are u32 through the phys_addr_t typedef:

#ifdef CONFIG_PHYS_ADDR_T_64BIT
typedef u64 phys_addr_t;
#else
typedef u32 phys_addr_t;
#endif

typedef phys_addr_t resource_size_t;
---

arch/x86/pci/acpi.c: In function ‘setup_resource’:
arch/x86/pci/acpi.c:271:4: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘resource_size_t’ [-Wformat=]
    dev_info(&info->bridge->dev,
    ^
arch/x86/pci/acpi.c:276:4: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘resource_size_t’ [-Wformat=]
    dev_info(&info->bridge->dev,
    ^
arch/x86/pci/acpi.c:276:4: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘resource_size_t’ [-Wformat=]

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ