[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v12.2 09/15] vpci/header: program p2m with guest BAR view
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Tue, 16 Jan 2024 22:01:24 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MNNHE6Ftb6vwaD5IemdXbcNRacTkAvCax9LPZskNdUU=; b=GrB6CciYu+EoMG4SykABHtb+k1injzeASqtRqi1ylIwIqFVwzE10Hphutgw0Vsh48sRgjlf648R8XnppMVPIpX+PXRqFOo81bV0+XCMBMJmaLa3xEli8HPU0rCbTV2vdTjnfWHi6PD8SEs4yhHkAqGOU9N4mqaMeN/v31X19+T/uxs0KQrcvj0w+OqLMm1VE9UM6uF7qzWA96+5c4ErcKLu7LrkGECiVHSAW1JSHP6bSiQA0E2B5K5g523pGBu8KZxgxvihbIrEIG+9DeTIiXO4LCFgL5+ASV4tL4QAqdrTzgmngvBzzUsRqH4egAJhK9GOHkMQqnYavUmT7BA1goQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qsc8TDzh7LFHkw9EsUQ5mQYXHCJlTesIqOYx62sedDL0cfTVkLM1O/3LoXnbhHa59kxgwRDyQGum1Isj0VK1GXzNLwBNUtVG2IovHuymXSwy2dVjSCQFe0JjNp9PFs9mB/HLIzA+m/CAvKXdjyoTxr9qkgxTFTbRs+T2wkqmAMWl63CRv6bRCcoP8+5AeXmRjHiKz/Na8+EkaPGaj0/i3MFCFriBVXsStlaCl36cjXjcGFYFjqswavATWvufSn+wCHlafV8iGEP/0hiiJRI7G4CKwZsIHz7Gkntee+C+rxAg7G4I2Oxhox6h0rZHqjocLOXPtF2b9k0UA7dkuv3RSw==
- Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
- Delivery-date: Wed, 17 Jan 2024 03:01:46 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 1/15/24 14:44, Stewart Hildebrand wrote:
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index feccd070ddd0..8483404c5e91 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -41,13 +42,24 @@ static int cf_check map_range(
> unsigned long s, unsigned long e, void *data, unsigned long *c)
> {
> const struct map_data *map = data;
> + /* Start address of the BAR as seen by the guest. */
> + unsigned long start_gfn = PFN_DOWN(map->bar->guest_addr);
> + /* Physical start address of the BAR. */
> + unsigned long start_mfn = PFN_DOWN(map->bar->addr);
> int rc;
>
> for ( ; ; )
> {
> unsigned long size = e - s + 1;
> + /*
> + * Ranges to be mapped don't always start at the BAR start address,
> as
> + * there can be holes or partially consumed ranges. Account for the
> + * offset of the current address from the BAR start.
> + */
> + unsigned long map_mfn = start_mfn + s - start_gfn;
> + unsigned long m_end = map_mfn + size - 1;
>
> - if ( !iomem_access_permitted(map->d, s, e) )
> + if ( !iomem_access_permitted(map->d, map_mfn, m_end) )
Nit: since this check will now use map_mfn and m_end...
> {
> printk(XENLOG_G_WARNING
> "%pd denied access to MMIO range [%#lx, %#lx]\n",
> map->d, s, e);
... I'd like to also update the arguments passed to this print statement.
|