[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 31 Jan 2022 11:56:27 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • 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=w+p+mpPH78GCxBYh8Q/sD+9whxnn1yZCYPXCGEANxWQ=; b=XNvqXThRxAN1i4UQnqGVu36hfxTjF89OzttrBubqNDpWIW5XSXYdzRNMB0KPcsUUc0raZJKooAVFG8OJfpx6hmKyjoCbCY5nzlPAKEZvAhmR6e+s/5GO4q8u8rjZG+c1FJPA3ErydlHs1ddPfVJGy8bLQVFaj/pbnCgLyq/ypJaoDQvnfR7H8Miq8x0nJDCDrihW8zqMLPGzqlkpsuIZ8MFgel847WUlWMF4VsqRTkErou8gGU8WoQUZwh9PVSluzJFc6/xtOL7AoiBAw2E7QrecgkjwujDIayJkeUA+qAQ+WTbBqPI0XJoDFI8niAfAxn7Rc1ymq8PPA6W2O3fjww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lfST2g3moNmfpZxdepccu1A/1rUv/Fp67au/MVMhDSFYiM9qLK3YfhX5dnD76rMUX3frsMFc/ubLJMYzIXnLgCG6VdSYozmvXTLXYc2IqWF534XCIQ0Qi7+8BwYl2xhDc8bi2w2sPu8G4WUu0v7ea7nNvNi0NM2FdskGrszjULjDvrzjiobFDU9mZ0t6svpekMz0ohAtwDJ0qmatJrhTmQ3K5Je5HNSJsnfdT/4izPyg6cObDQXvvjgi1M/XHPUymAqb9yPsJZ5SPiLtcEStZkmPLLuMIRrG3aftL48v7Pd/yeR9e4EHuc+6Y+Q4SdStBljKmqEJrkbobYymb8E07g==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • Delivery-date: Mon, 31 Jan 2022 10:56:46 +0000
  • Ironport-data: A9a23:JWzkcK+dIDu1axvYCcMBDrUDtHiTJUtcMsCJ2f8bNWPcYEJGY0x3y TMYWG/VbqncYWDwKNAib9628xlUvsfRyINlHlRqqi48E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7di29Yx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhO6 /ZHtMacYD4lBa2Ws+8xfQFqLw5HaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9Ooh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-sdr: s8KAeqLX1lM8cFmks4HZ2jtvIj/T6Mq28fF88jGQg+WFCHPHQGdoClz5SRiJzS++FeKgzHDBn9 mcF/47njaLufyzGpkYdsZQEiOipxYfHTREMM0bz/k5kNVOoaMxhRwbquxCymdja8GiGqjMkppC px49ECVN3YAdfCKiVczNq+BnWiHATtjfZpag9SffHfaVwPvJQ7qKkE9TJVUP2FGS3AMHl20y0i w8+rEzH/HOAzBxCZyC+Pm3934pqUiwigqUBaLa0ISnymvnRAKCS2qPHrcncKNB0p7fSh4ZcTD9 pj/k2J5rnrtJXQTQZ48MbaUo
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jan 31, 2022 at 09:53:29AM +0000, Oleksandr Andrushchenko wrote:
> Hi, Roger!
> 
> On 12.01.22 19:34, Roger Pau Monné wrote:
> > A couple more comments I realized while walking the dog.
> >
> > On Thu, Nov 25, 2021 at 01:02:43PM +0200, Oleksandr Andrushchenko wrote:
> >> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> >> @@ -569,8 +625,10 @@ static int init_bars(struct pci_dev *pdev)
> >>           bars[i].size = size;
> >>           bars[i].prefetchable = val & PCI_BASE_ADDRESS_MEM_PREFETCH;
> >>   
> >> -        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, bar_write, 
> >> reg, 4,
> >> -                               &bars[i]);
> >> +        rc = vpci_add_register(pdev->vpci,
> >> +                               is_hwdom ? vpci_hw_read32 : guest_bar_read,
> >> +                               is_hwdom ? bar_write : guest_bar_write,
> >> +                               reg, 4, &bars[i]);
> > You need to initialize guest_reg to the physical host value also.
> But why? There was a concern that exposing host's value to a guest
> may be a security issue. And wouldn't it be possible for a guest to decide
> that the firmware has setup the BAR and it doesn't need to care of it and
> hence use a wrong value instead of setting it up by itself? I had an issue
> with that if I'm not mistaken that guest's Linux didn't set the BAR properly
> and used what was programmed

I think I've made that comment before realizing that all BARs must
start with memory decoding disabled for guests, so that the guest
firmware can position them. Using the host value as a starting point
doesn't make sense because there's no relation between the guest and
the host memory maps. You can drop this comment.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.