From patchwork Mon Jul 22 07:07:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duan, Zhenzhong" X-Patchwork-Id: 13738485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C445EC3DA59 for ; Mon, 22 Jul 2024 07:10:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVnBS-0002D4-BO; Mon, 22 Jul 2024 03:10:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVnBE-0001bG-C5; Mon, 22 Jul 2024 03:09:58 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVnBC-0007xR-Ac; Mon, 22 Jul 2024 03:09:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721632194; x=1753168194; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GNcd8+e1ykeXTzuWo92JtUoMGk5rOPr76RQ3pZl93o4=; b=G69Nipg2hKTpIgxBLyOV1F6R8ZiHxk8VzIEv1Xs+j9ZRjI2C0HQSGuyJ JqW2MnhmHp59EU1UFrMZKUa+o1dHR+lh62c6tObhDtoa23oGyFmD55yRE fQGCSure5QfT5l5hL1xKbacI76xg0NaLa4zoejJCoLFPugFUdSoIRc0Ri 355MpH8EM8Ohu/J73L8jq6oiZtWfrmKVlDDzkmQ3mWFR4eJUSFJRlH1Qx cLPCyYMjY2IlobDgVWqIpSfKbKa3d6ciSc8Sv3aUzyt5rfK6K66LJCFRn DU/qJV5ifSawAXojvPEez3kCfpRIbpNJZDxr08tpPZQDWWPKrpyI9DFBq Q==; X-CSE-ConnectionGUID: 41R8ouDoRjyYY42UnUQV+Q== X-CSE-MsgGUID: ozx66F2tRVKdhPkPn4Tt1g== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="19332603" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="19332603" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 00:09:51 -0700 X-CSE-ConnectionGUID: 8vkKIvulTCmV0KO7E0rovw== X-CSE-MsgGUID: AOiEfMnrT56HtvkFuDF1HA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="82808736" Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 00:09:48 -0700 From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, eric.auger@redhat.com, joao.m.martins@oracle.com, chao.p.peng@intel.com, Zhenzhong Duan , Thomas Huth , Tony Krowiak , Halil Pasic , Jason Herne , qemu-s390x@nongnu.org (open list:S390 general arch...) Subject: [PATCH 1/2] vfio/ap: Don't initialize HOST_IOMMU_DEVICE with mdev Date: Mon, 22 Jul 2024 15:07:12 +0800 Message-Id: <20240722070713.1342711-2-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722070713.1342711-1-zhenzhong.duan@intel.com> References: <20240722070713.1342711-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org mdevs aren't "physical" devices and when asking for backing IOMMU info, it fails the entire provisioning of the guest. Fix that by setting vbasedev->mdev true so skipping HostIOMMUDevice initialization in the presence of mdevs. Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") Signed-off-by: Zhenzhong Duan Reviewed-by: Joao Martins --- hw/vfio/ap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 0c4354e3e7..391bfb72ca 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -230,6 +230,9 @@ static void vfio_ap_instance_init(Object *obj) */ vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_AP, &vfio_ap_ops, DEVICE(vapdev), true); + + /* AP device is mdev type device */ + vbasedev->mdev = true; } #ifdef CONFIG_IOMMUFD From patchwork Mon Jul 22 07:07:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duan, Zhenzhong" X-Patchwork-Id: 13738486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E06F9C3DA5D for ; Mon, 22 Jul 2024 07:10:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVnBu-00049x-He; Mon, 22 Jul 2024 03:10:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVnBG-0001kR-2d; Mon, 22 Jul 2024 03:09:59 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVnBD-0007xL-IX; Mon, 22 Jul 2024 03:09:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721632195; x=1753168195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GR8DquOYnpIKBHfRCqyHBKcsVC//Ilyvb+EFGW2rF/M=; b=V1c9e25XWo8ZRPiJv6esaFiXG3A4azJ+tgK8SKjq40RzRNpuWbNvEbUO xnvj3A7ACXLk+Xlm1huAdYkG8+l7rAxgT/7GVX+wZO04u8hLtEvnTLJH5 pGGhKO17OAc6ERUcpWDvZOEzJDqrKMfdK+fBiIoC8XmE+e2erWTYI1NeU cmrMp+IAbD/tzHCSq4GLb7Jqhluwi8BaBpdjlxt866soVdWnEy8+/hKIO oLWbm711hRRCTEfXYe7NV0WFYA1aAXe6G+KxQNVD8r5Rn3Mgk+EGwAuV0 9HRVOVXMZHezZCu0jcN85F7eivVSlklqFrv4irNlcJC0V2NNChh7kF4Zq Q==; X-CSE-ConnectionGUID: SkTwdVWmRpqCRYZWisyOPw== X-CSE-MsgGUID: zD9pu7yNRuGMcoMFxz2w8Q== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="19332619" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="19332619" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 00:09:54 -0700 X-CSE-ConnectionGUID: 5rgVRUeaRSCgkxR4fT682Q== X-CSE-MsgGUID: 62WzRfYbT2muZYSZBuCspg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="82808742" Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 00:09:51 -0700 From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, eric.auger@redhat.com, joao.m.martins@oracle.com, chao.p.peng@intel.com, Zhenzhong Duan , Thomas Huth , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org (open list:S390 general arch...) Subject: [PATCH 2/2] vfio/ccw: Don't initialize HOST_IOMMU_DEVICE with mdev Date: Mon, 22 Jul 2024 15:07:13 +0800 Message-Id: <20240722070713.1342711-3-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722070713.1342711-1-zhenzhong.duan@intel.com> References: <20240722070713.1342711-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org mdevs aren't "physical" devices and when asking for backing IOMMU info, it fails the entire provisioning of the guest. Fix that by setting vbasedev->mdev true so skipping HostIOMMUDevice initialization in the presence of mdevs. Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") Signed-off-by: Zhenzhong Duan Reviewed-by: Joao Martins Acked-by: Eric Farman --- hw/vfio/ccw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 1f8e1272c7..70934b01d5 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -675,6 +675,9 @@ static void vfio_ccw_instance_init(Object *obj) VFIOCCWDevice *vcdev = VFIO_CCW(obj); VFIODevice *vbasedev = &vcdev->vdev; + /* CCW device is mdev type device */ + vbasedev->mdev = true; + /* * All vfio-ccw devices are believed to operate in a way compatible with * discarding of memory in RAM blocks, ie. pages pinned in the host are