From patchwork Sat Sep 14 15:37:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 11145693 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F38AE14DB for ; Sat, 14 Sep 2019 15:40:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE6FE20717 for ; Sat, 14 Sep 2019 15:40:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Ju7RwnY8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE6FE20717 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i9A7K-0001Fb-Ps; Sat, 14 Sep 2019 15:37:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i9A7K-0001FW-2z for xen-devel@lists.xenproject.org; Sat, 14 Sep 2019 15:37:42 +0000 X-Inumbo-ID: 96435586-d705-11e9-978d-bc764e2007e4 Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 96435586-d705-11e9-978d-bc764e2007e4; Sat, 14 Sep 2019 15:37:40 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 7DE6922CB; Sat, 14 Sep 2019 11:37:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 14 Sep 2019 11:37:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=c2o5lK vdmnmAMmY0vU0WTM9pkb2OfizLctsWtk+XLHY=; b=Ju7RwnY8vnbepuNMki9cKp kbNn6i8NEA40IhZpVm9VyUuPlcIjzTVxxWAZn3TIoROSGu4t/QOXb++F/apQVI2W q9YKIfcffiyAqaHw2cCIjy4j4wv7iUF2y3P3z+kdtehP0y5gJvHOrydscGxza0hL H0LAdUdUZFY+0GbU9FBvjMTqqwPzk1bxfKkz5R3BI8kcMfW+wZY0uKByNjmig314 yAusaA5s9duXY3yjsOt1o7EVJjcw7kLk57dcILgvQTZ5rIQt1KK6Shj7ove2gICf HBnwWVFLZ+CU55AUJNpK64fPWqtHJ22jHiAjxdreXl4k/RmpqprdGnilvbMaBAcw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrtdelgdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculddqiedmnecujfgurhephffvufffkffogggtgfesthekredtredtjeen ucfhrhhomhepofgrrhgvkhcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomh grrhhmrghrvghksehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuffho mhgrihhnpehquhgsvghsqdhoshdrohhrghenucfkphepledurdeihedrfeegrdeffeenuc frrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslhgvthhh ihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id E274ED60057; Sat, 14 Sep 2019 11:37:36 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Sat, 14 Sep 2019 17:37:15 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v6 0/6] Fix PCI passthrough for HVM with stubdomain X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Stefano Stabellini , Suravee Suthikulpanit , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich , Anthony PERARD , Daniel De Graaf , Brian Woods , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In this version, I add PHYSDEVOP_interrupt_control to allow stubdomain enabling MSI after mapping it, and also disabling INTx beforehand. Actual hypercall refuse to enable both of them. Related article: https://www.qubes-os.org/news/2017/10/18/msi-support/ Changes in v2: - new "xen/x86: Allow stubdom access to irq created for msi" patch - applied review comments from v1 Changes is v3: - apply suggestions by Roger - add PHYSDEVOP_msi_msix_set_enable Changes in v4: - implement suggestions by Wei, Roger, Jan - plug new physdevop into XSM Changes in v5: - rebase on master - rename to PHYSDEVOP_msi_control - move granting access to IRQ into create_irq Changes in v6: - simplify granting IRQ access, record dm domid for cleanup - rename to PHYSDEVOP_interrupt_control - include INTx control in the hypercall --- Cc: Ian Jackson Cc: Wei Liu Cc: Andrew Cooper Cc: George Dunlap Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Anthony PERARD Cc: "Roger Pau Monné" Cc: Suravee Suthikulpanit Cc: Brian Woods Cc: Kevin Tian Cc: Daniel De Graaf Marek Marczykowski-Górecki (6): libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use libxl: attach PCI device to qemu only after setting pciback/pcifront libxl: don't try to manipulate json config for stubdomain xen/x86: Allow stubdom access to irq created for msi. xen/x86: add PHYSDEVOP_interrupt_control tools/libxc: add wrapper for PHYSDEVOP_interrupt_control tools/libxc/include/xenctrl.h | 6 ++- tools/libxc/xc_physdev.c | 15 ++++++- tools/libxl/libxl_pci.c | 63 +++++++++++++++++-------- xen/arch/x86/hpet.c | 3 +- xen/arch/x86/irq.c | 51 ++++++++++++++------ xen/arch/x86/msi.c | 45 ++++++++++++++++++- xen/arch/x86/physdev.c | 53 +++++++++++++++++++++- xen/arch/x86/x86_64/physdev.c | 4 ++- xen/drivers/char/ns16550.c | 2 +- xen/drivers/passthrough/amd/iommu_init.c | 2 +- xen/drivers/passthrough/vtd/iommu.c | 3 +- xen/include/asm-x86/irq.h | 7 ++- xen/include/asm-x86/msi.h | 2 +- xen/include/public/physdev.h | 23 +++++++++- xen/include/xlat.lst | 1 +- xen/include/xsm/dummy.h | 7 +++- xen/include/xsm/xsm.h | 6 ++- xen/xsm/dummy.c | 1 +- xen/xsm/flask/hooks.c | 24 ++++++++++- xen/xsm/flask/policy/access_vectors | 1 +- 20 files changed, 281 insertions(+), 38 deletions(-) base-commit: 6c9639a72f0ca3a9430ef75f375877182281fdef