Yi, Shunli
2009-Jul-10 03:57 UTC
[Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right?
Hi: I''m using the Xen-3.3.1. and I find Xend doesn''t permit the DomU driver to access the msix_iomem. "xend/server/pciif.py" : Line :342. if dev.msix: for (start, size) in dev.msix_iomem: start_pfn = start>>PAGE_SHIFT nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT log.debug(''pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x'' % \ (start,size, start_pfn, nr_pfns)) rc = xc.domain_iomem_permission(domid = fe_domid, first_pfn = start_pfn, nr_pfns = nr_pfns, allow_access = False) I haven''t wrote any driver code, but I think the driver should can write messages to the msix_iomem. Because the driver will write some MSI information to the MSI register. And I find following code in bnx2-1.8.5b: File : bnx2.c Version: 1.8.5b Function: bnx2_enable_msix() bnx2_setup_msix_tbl(bp); REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); So, I think the msix_iomem should be always writable for the DomU. Am I Right? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 Protected by Websense Hosted Email Security -- www.websense.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jiang, Yunhong
2009-Jul-10 04:56 UTC
RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right?
The MSI-x will include vector information, which should be resource owned by Xen HV. For example, if domU set the vector to be same as another device that owned by another domain (or dom0), or Xen HV's IPI, then it will cause trouble. --jyh ________________________________ From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Yi, Shunli Sent: 2009年7月10日 11:57 To: xen-devel@lists.xensource.com Subject: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? Hi: I’m using the Xen-3.3.1. and I find Xend doesn’t permit the DomU driver to access the msix_iomem. "xend/server/pciif.py" : Line :342. if dev.msix: for (start, size) in dev.msix_iomem: start_pfn = start>>PAGE_SHIFT nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT log.debug('pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x' % \ (start,size, start_pfn, nr_pfns)) rc = xc.domain_iomem_permission(domid = fe_domid, first_pfn = start_pfn, nr_pfns = nr_pfns, allow_access = False) I haven’t wrote any driver code, but I think the driver should can write messages to the msix_iomem. Because the driver will write some MSI information to the MSI register. And I find following code in bnx2-1.8.5b: File : bnx2.c Version: 1.8.5b Function: bnx2_enable_msix() bnx2_setup_msix_tbl(bp); REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); So, I think the msix_iomem should be always writable for the DomU. Am I Right? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 Protected by Websense Hosted Email Security — www.websense.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yi, Shunli
2009-Jul-10 05:18 UTC
RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right?
But how should I to understand the REG_WR() code when load the bnx2 module ? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 From: Jiang, Yunhong [mailto:yunhong.jiang@intel.com] Sent: 2009年7月10日 12:57 To: Yi, Shunli; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? The MSI-x will include vector information, which should be resource owned by Xen HV. For example, if domU set the vector to be same as another device that owned by another domain (or dom0), or Xen HV's IPI, then it will cause trouble. --jyh ________________________________ From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Yi, Shunli Sent: 2009年7月10日 11:57 To: xen-devel@lists.xensource.com Subject: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? Hi: I’m using the Xen-3.3.1. and I find Xend doesn’t permit the DomU driver to access the msix_iomem. "xend/server/pciif.py" : Line :342. if dev.msix: for (start, size) in dev.msix_iomem: start_pfn = start>>PAGE_SHIFT nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT log.debug('pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x' % \ (start,size, start_pfn, nr_pfns)) rc = xc.domain_iomem_permission(domid = fe_domid, first_pfn = start_pfn, nr_pfns = nr_pfns, allow_access = False) I haven’t wrote any driver code, but I think the driver should can write messages to the msix_iomem. Because the driver will write some MSI information to the MSI register. And I find following code in bnx2-1.8.5b: File : bnx2.c Version: 1.8.5b Function: bnx2_enable_msix() bnx2_setup_msix_tbl(bp); REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); So, I think the msix_iomem should be always writable for the DomU. Am I Right? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 Protected by Websense Hosted Email Security — www.websense.com Click here<https://www.mailcontrol.com/sr/fOIdUYOqmzzTndxI!oX7Unz1!gA0DCbi5C9yzKzZzqv7h2CAQUNYbCmzB6qvuYmyOch4pXG936kd5rLFZ!o!pA==> to report this email as spam. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jiang, Yunhong
2009-Jul-10 05:33 UTC
RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right?
Sorry that I don't know what's bnx and is it a Linux driver? Basically domU will depends on pci backend to enable MSI/MSI-x. --jyh ________________________________ From: Yi, Shunli [mailto:syi@websense.com] Sent: 2009年7月10日 13:19 To: Jiang, Yunhong; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? But how should I to understand the REG_WR() code when load the bnx2 module ? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 From: Jiang, Yunhong [mailto:yunhong.jiang@intel.com] Sent: 2009年7月10日 12:57 To: Yi, Shunli; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? The MSI-x will include vector information, which should be resource owned by Xen HV. For example, if domU set the vector to be same as another device that owned by another domain (or dom0), or Xen HV's IPI, then it will cause trouble. --jyh ________________________________ From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Yi, Shunli Sent: 2009年7月10日 11:57 To: xen-devel@lists.xensource.com Subject: [Xen-devel] Drivers cannot write to msix_iomem from DomU, is this right? Hi: I’m using the Xen-3.3.1. and I find Xend doesn’t permit the DomU driver to access the msix_iomem. "xend/server/pciif.py" : Line :342. if dev.msix: for (start, size) in dev.msix_iomem: start_pfn = start>>PAGE_SHIFT nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT log.debug('pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x' % \ (start,size, start_pfn, nr_pfns)) rc = xc.domain_iomem_permission(domid = fe_domid, first_pfn = start_pfn, nr_pfns = nr_pfns, allow_access = False) I haven’t wrote any driver code, but I think the driver should can write messages to the msix_iomem. Because the driver will write some MSI information to the MSI register. And I find following code in bnx2-1.8.5b: File : bnx2.c Version: 1.8.5b Function: bnx2_enable_msix() bnx2_setup_msix_tbl(bp); REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1); REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE); REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE); So, I think the msix_iomem should be always writable for the DomU. Am I Right? Best Regards! SHUNLI YI WEBSENSE NETWORK SECURITY TECHNOLOGY R&D (BEIJING) CO. LTD. ph: +8610.5884.4142 Protected by Websense Hosted Email Security — www.websense.com Click here<https://www.mailcontrol.com/sr/fOIdUYOqmzzTndxI!oX7Unz1!gA0DCbi5C9yzKzZzqv7h2CAQUNYbCmzB6qvuYmyOch4pXG936kd5rLFZ!o!pA==> to report this email as spam. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel