From patchwork Thu Sep 27 16:46:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10618221 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 D2581913 for ; Thu, 27 Sep 2018 16:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C03602B6B8 for ; Thu, 27 Sep 2018 16:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1CDA2B6FD; Thu, 27 Sep 2018 16:53:38 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 25FD82B6B8 for ; Thu, 27 Sep 2018 16:53:38 +0000 (UTC) Received: from localhost ([::1]:38098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5ZXl-00076r-6S for patchwork-qemu-devel@patchwork.kernel.org; Thu, 27 Sep 2018 12:53:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5ZQe-0007ti-Ry for qemu-devel@nongnu.org; Thu, 27 Sep 2018 12:46:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5ZQc-0002Rl-JW for qemu-devel@nongnu.org; Thu, 27 Sep 2018 12:46:16 -0400 Received: from mail-co1nam03on0071.outbound.protection.outlook.com ([104.47.40.71]:58376 helo=NAM03-CO1-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 1g5ZQc-0002E8-8X for qemu-devel@nongnu.org; Thu, 27 Sep 2018 12:46:14 -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=9LJXJISJk3xwxHpNWq+bIonRni5UJzC0t1RM7Sc15pc=; b=wJ9vtYvSILDxZWN3n34KabYk4k2OvhTwkWLko4AqeHUglqYpOfsGkDJzSPyWpxCESLmhjFj6iWCEICGrx2LG9drx37K2yEaSS+QuMQsQImCrvbiMJlcwmrndBsyezM2K2SWeY7TfJQ3VFh8J2ctrkeGMES9uZq1UVb/E5fuwyj4= Received: from DM6PR12MB2682.namprd12.prod.outlook.com (20.176.116.31) by DM6PR12MB2748.namprd12.prod.outlook.com (20.176.118.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Thu, 27 Sep 2018 16:46:02 +0000 Received: from DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::7c34:f2e8:a8a9:cab8]) by DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::7c34:f2e8:a8a9:cab8%3]) with mapi id 15.20.1164.024; Thu, 27 Sep 2018 16:46:02 +0000 From: "Singh, Brijesh" To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v4 9/9] x86_iommu/amd: Enable Guest virtual APIC support Thread-Index: AQHUVoGTLV4/Zc3X10i+PEoLp2cyfw== Date: Thu, 27 Sep 2018 16:46:02 +0000 Message-ID: <1538066739-13095-10-git-send-email-brijesh.singh@amd.com> References: <1538066739-13095-1-git-send-email-brijesh.singh@amd.com> In-Reply-To: <1538066739-13095-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: CY4PR1201CA0007.namprd12.prod.outlook.com (2603:10b6:910:16::17) 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; DM6PR12MB2748; 20:EgJzu0d7ifrnKS/VxSvDJCpyiEj1JB+aA5/l9N5LjcQO5abGssIZQV667jnlqFrm5xuWVeFzm29wcQqUddW3CEQN7iGf5w3zWr3pyNau+MSuXXJeySPrrLD3wXWadR6Y8WbaBuxEEEUNR0+3cCJBLn939flcPzEZEd4b1LfOuEgzRSOCIYzZ5sIkQjNfxyo6bChW/S5qy5yjWJQlTAudRjp1ORtZY6JO5dGTsA03Vy9nHX37Jb6cyRJaaulv0z+k x-ms-office365-filtering-correlation-id: 7827b7db-5994-4763-f75f-08d62498b598 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:DM6PR12MB2748; x-ms-traffictypediagnostic: DM6PR12MB2748: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(211171220733660)(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)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051); SRVR:DM6PR12MB2748; BCL:0; PCL:0; RULEID:; SRVR:DM6PR12MB2748; x-forefront-prvs: 0808323E97 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(136003)(396003)(376002)(199004)(189003)(8676002)(6916009)(2351001)(54906003)(86362001)(105586002)(14454004)(7736002)(106356001)(99286004)(34290500001)(36756003)(2906002)(305945005)(68736007)(81156014)(478600001)(5660300001)(5640700003)(6116002)(3846002)(26005)(81166006)(39060400002)(2616005)(446003)(76176011)(2900100001)(6486002)(6506007)(5250100002)(8936002)(316002)(476003)(11346002)(256004)(71200400001)(52116002)(71190400001)(53936002)(2501003)(66066001)(6436002)(486006)(97736004)(102836004)(25786009)(4326008)(6512007)(186003)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2748; H:DM6PR12MB2682.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3d5gFxDfm1d/R0bVePxqYQQAY7tCmFfUykhh8OeCXRk/jRDkV5wTuK3EcNQNhA038qvzD8KTLjkcpoANrb3JOzuWtS5uf90htLG9mFuq7olDAxBUBpbTlCBewp9wBOIecaxgJJ5cHRAw+h+vzW2hzYUQ0v5UfJpr4uh227x6lB1N2fiFOFpOpA4tz2JxZf0NR8F3zQ2Wi0To7DbI/fOzlUFcE4up1jSd3r5jbofj5GSZ6qlzLGltNkPtf92afYAQkl9Oe8xpkIBx+M41rQoV+pgS+5LURSCDw+iCW2EcscdQR9AYT0D3JU7ShudDTrmsRYVOCLIgyUWVgo42UJgrtUurX8HhIUO2ng6ec6SuP3E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7827b7db-5994-4763-f75f-08d62498b598 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2018 16:46:02.3576 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2748 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.71 Subject: [Qemu-devel] [PATCH v4 9/9] x86_iommu/amd: Enable Guest virtual APIC support 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 Now that amd-iommu support interrupt remapping, enable the GASup in IVRS table and GASup in extended feature register to indicate that IOMMU support guest virtual APIC mode. GASup provides option to guest OS to make use of 128-bit IRTE. Note that the GAMSup is set to zero to indicate that amd-iommu does not support guest virtual APIC mode (aka AVIC) which would be used for the nested VMs. See Table 21 from IOMMU spec for interrupt virtualization controls 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/acpi-build.c | 3 ++- hw/i386/amd_iommu.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 1ef396d..236a20e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2518,7 +2518,8 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker) build_append_int_noprefix(table_data, (48UL << 30) | /* HATS */ (48UL << 28) | /* GATS */ - (1UL << 2), /* GTSup */ + (1UL << 2) | /* GTSup */ + (1UL << 6), /* GASup */ 4); /* * Type 1 device entry reporting all devices diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 8061e9c..687fcd8 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -176,7 +176,7 @@ /* extended feature support */ #define AMDVI_EXT_FEATURES (AMDVI_FEATURE_PREFETCH | AMDVI_FEATURE_PPR | \ AMDVI_FEATURE_IA | AMDVI_FEATURE_GT | AMDVI_FEATURE_HE | \ - AMDVI_GATS_MODE | AMDVI_HATS_MODE) + AMDVI_GATS_MODE | AMDVI_HATS_MODE | AMDVI_FEATURE_GA) /* capabilities header */ #define AMDVI_CAPAB_FEATURES (AMDVI_CAPAB_FLAT_EXT | \