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: <4A20060C.2050701@goop.org>
Date:	Fri, 29 May 2009 08:58:04 -0700
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Ian Campbell <ian.campbell@...rix.com>
CC:	linux-kernel@...r.kernel.org,
	Becky Bruce <beckyb@...nel.crashing.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Kumar Gala <galak@...nel.crashing.org>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Ingo Molnar <mingo@...e.hu>, linuxppc-dev@...abs.org
Subject: Re: [PATCH 8/9] swiotlb: support HIGHMEM in swiotlb_bus_to_virt

Ian Campbell wrote:
> Rather than supplying a __weak hook which architectures which support
> highmem can overide simply provide a version of swiotlb_bus_to_virt
> which works with high memory. Make it conditional since it is a more
> expensive variant than the non-highmem version.
>
> Acutal function contents taken from the PowerPC swiotlb patchset by
> Becky Bruce.
>
> Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
> Cc: Becky Bruce <beckyb@...nel.crashing.org>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Kumar Gala <galak@...nel.crashing.org>
> Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Jeremy Fitzhardinge <jeremy@...p.org>
> Cc: linuxppc-dev@...abs.org
> ---
>  lib/swiotlb.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index e332342..c50a5ed 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -130,10 +130,22 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev,
>  	return phys_to_dma(hwdev, virt_to_phys(address));
>  }
>  
> -void * __weak swiotlb_bus_to_virt(struct device *hwdev, dma_addr_t address)
> +#ifdef CONFIG_HIGHMEM
> +static void * swiotlb_bus_to_virt(struct device *hwdev, dma_addr_t address)
>   

I think it would be better to put the #ifdef within the function body so 
that there's no chance of prototype-drift.
> +{
> +	unsigned long pfn = PFN_DOWN(dma_to_phys(hwdev, addr));
> +	void *pageaddr = page_address(pfn_to_page(pfn));
> +
> +	if (pageaddr != NULL)
> +		return pageaddr + (addr % PAGE_SIZE);
>   
Is there an arch-independent test to see if a pfn is considered highmem 
or not (which returns a constant on non-highmem configurations)?  If so, 
then I think this could be common without having to go via a struct page.

    J
--
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