From patchwork Fri Sep 21 14:25:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10610173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 072DD112B for ; Fri, 21 Sep 2018 14:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E86D02DFC3 for ; Fri, 21 Sep 2018 14:27:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC8052DFE7; Fri, 21 Sep 2018 14:27:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C8082DFC3 for ; Fri, 21 Sep 2018 14:27:20 +0000 (UTC) Received: from localhost ([::1]:55910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3MOt-0002nw-O7 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 10:27:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3MNK-0001bT-98 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 10:25:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3MNF-0001Ch-Gi for qemu-devel@nongnu.org; Fri, 21 Sep 2018 10:25:42 -0400 Received: from mail-bl2nam02on0053.outbound.protection.outlook.com ([104.47.38.53]:59296 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g3MNF-0001Ba-BF for qemu-devel@nongnu.org; Fri, 21 Sep 2018 10:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gzXZynEfCcFIXtSokYuavKsqkYY61mCI+0SpExWdrIo=; b=FegeFuJXmObkM3Lu+LS5CNZdqaqhgFdL4qZJOzKUcrTxc0yeyWkhRJmbYVE0J0vJvZyqeoWSloKCK/YkpLYX/uKma/uqfNrB68a0cRV28V4V+ArhXpBEz+0modsrmlCyCbOoDWurF9u1E8jF6/DdkFRw5lnf1Bt5wxkXxZM8Hok= Received: from DM6PR12MB2682.namprd12.prod.outlook.com (20.176.116.31) by DM6PR12MB2618.namprd12.prod.outlook.com (20.176.116.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 14:25:35 +0000 Received: from DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::7c34:f2e8:a8a9:cab8]) by DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::7c34:f2e8:a8a9:cab8%2]) with mapi id 15.20.1143.017; Fri, 21 Sep 2018 14:25:35 +0000 From: "Singh, Brijesh" To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v3 1/9] x86_iommu: move the kernel-irqchip check in common code Thread-Index: AQHUUbb1/oAfEvXDyEWLy+53VAJQJQ== Date: Fri, 21 Sep 2018 14:25:35 +0000 Message-ID: <1537539920-30662-2-git-send-email-brijesh.singh@amd.com> References: <1537539920-30662-1-git-send-email-brijesh.singh@amd.com> In-Reply-To: <1537539920-30662-1-git-send-email-brijesh.singh@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DM5PR21CA0008.namprd21.prod.outlook.com (2603:10b6:3:ac::18) To DM6PR12MB2682.namprd12.prod.outlook.com (2603:10b6:5:4a::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM6PR12MB2618; 20:qsQ6tlZ74niI8d+IoLWRfQpS4/ELrF+gOiu/8hgLORhDbtSxR3tFLHfELUAkcX1XrPvoA4A/FElQSbIO0N/nKFsOgy4vnbsVPke+JZD3zJvIUMrih38PwJ1ZWu5FsjXn4i5GCZapzO8AWEdzYUsUggPL7loq+lzmp6f4L1iIks3QtQIg85OE8HT0hEYYqBgMInA5QIpIT1BnEeVlETTM+OT47MUodtIZrl7AnFx1/4CySpRp8HUzLShPahseL0k6 x-ms-office365-filtering-correlation-id: 81c2d377-30eb-46a0-911f-08d61fce184d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR12MB2618; x-ms-traffictypediagnostic: DM6PR12MB2618: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(767451399110)(85827821059158); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(201708071742011)(7699051); SRVR:DM6PR12MB2618; BCL:0; PCL:0; RULEID:; SRVR:DM6PR12MB2618; x-forefront-prvs: 0802ADD973 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(376002)(366004)(136003)(189003)(199004)(106356001)(7736002)(4326008)(2906002)(76176011)(5660300001)(2900100001)(97736004)(6916009)(486006)(8676002)(2501003)(2616005)(6436002)(71200400001)(71190400001)(256004)(5640700003)(6486002)(54906003)(86362001)(26005)(6512007)(53936002)(52116002)(2351001)(8936002)(99286004)(316002)(36756003)(5250100002)(66066001)(478600001)(186003)(305945005)(81156014)(105586002)(6116002)(68736007)(11346002)(446003)(3846002)(14454004)(25786009)(6506007)(81166006)(386003)(476003)(39060400002)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2618; H:DM6PR12MB2682.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ds9qUhZB3PoC2EFA6ZCTO2QyVS+D/+YDHTtt4/oj5TFMVGAm2BFCyqXIo2G/VJjxHKL3Egbb5fsAXg9WEhhYBL3/LWLrf1aCHUZaW9ip+nv3/D+x2C8+ll/ct+PfKUUAcoFsTMDhSYgHAo4tY7nQaqxuXj1hIhY1Ct1Lx2kn+K9BJsax2PPYMSP32BtuSJv5rbmlqoLmJoO5ppZiVbFNNCJ0W1eLBOri/s8oJO+PwMXZ4cCyQwyIWb0A/OYuitc9RPZNnFikgiR+BTyk0ZP99hu+bgV0mAT5S1ZnwetREoUFGrogDUnZ5KXMqUsac5iNtWrQ4KgHup8CPukFw5Plyjd0IBOMP7K5YrMN4GpkGCQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81c2d377-30eb-46a0-911f-08d61fce184d X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2018 14:25:35.4870 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2618 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.53 Subject: [Qemu-devel] [PATCH v3 1/9] x86_iommu: move the kernel-irqchip check in common code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Lendacky, Thomas" , "Singh, Brijesh" , Eduardo Habkost , "Michael S. Tsirkin" , Peter Xu , Paolo Bonzini , "Suthikulpanit, Suravee" , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Interrupt remapping needs kernel-irqchip={off|split} on both Intel and AMD platforms. Move the check in common place. Signed-off-by: Brijesh Singh Reviewed-by: Peter Xu Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom Lendacky Cc: Suravee Suthikulpanit --- hw/i386/intel_iommu.c | 7 ------- hw/i386/x86-iommu.c | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 3dfada1..84dbc20 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3248,13 +3248,6 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) { X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s); - /* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */ - if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && - !kvm_irqchip_is_split()) { - error_setg(errp, "Intel Interrupt Remapping cannot work with " - "kernel-irqchip=on, please use 'split|off'."); - return false; - } if (s->intr_eim == ON_OFF_AUTO_ON && !x86_iommu->intr_supported) { error_setg(errp, "eim=on cannot be selected without intremap=on"); return false; diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index 8a01a2d..7440cb8 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -25,6 +25,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "trace.h" +#include "sysemu/kvm.h" void x86_iommu_iec_register_notifier(X86IOMMUState *iommu, iec_notify_fn fn, void *data) @@ -94,6 +95,14 @@ static void x86_iommu_realize(DeviceState *dev, Error **errp) return; } + /* Both Intel and AMD IOMMU IR only support "kernel-irqchip={off|split}" */ + if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && + !kvm_irqchip_is_split()) { + error_setg(errp, "Interrupt Remapping cannot work with " + "kernel-irqchip=on, please use 'split|off'."); + return; + } + if (x86_class->realize) { x86_class->realize(dev, errp); }