Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbdHPPzO (ORCPT ); Wed, 16 Aug 2017 11:55:14 -0400 Received: from mail-dm3nam03on0042.outbound.protection.outlook.com ([104.47.41.42]:35008 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751949AbdHPPzL (ORCPT ); Wed, 16 Aug 2017 11:55:11 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Janakarajan.Natarajan@amd.com; From: Janakarajan Natarajan To: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Paolo Bonzini , Radim Krcmar , Joerg Roedel , Andy Lutomirski , Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Yazen Ghannam , Janakarajan Natarajan Subject: [PATCH 0/2] KVM: SVM: Virtual GIF Date: Wed, 16 Aug 2017 10:54:48 -0500 Message-Id: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR15CA0004.namprd15.prod.outlook.com (10.172.74.14) To CY4PR12MB1671.namprd12.prod.outlook.com (10.172.72.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9519c48a-66a9-4779-2fcf-08d4e4bf2bc4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR12MB1671; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1671;3:jxAs3qUElh9m3NfNQhXF7ka6hX+D7cnMUUNYuhSwkXNneZ2CaVApytoyH5VieKjpoWEKjDzIqK+bNxRGd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D3X+C4IkUy15WM0exSi3mgwpDDnEFlQWe5WcyE1HQqDV/Wwkm2ys+XyI1DZrtUGNT/hL6OqCGcEpKuxrlT7hOKMkKrbnHkIPJ/wQzX3Vsop3LAUeYSmNdeJavV3NY03nYx2v7IJUiJQUJGnbK7TlBbHIuNtW4rLJmZuwrmYdjgDb7Jwh0IU8G8NE4ITcV5VaPmHJ1B7TBrMFLPuwZ/ALEwTPsZrctVamnrc8crz7SzUjaaC8mWe2P0XaYya8V02CzNJeN;4:Y+EZPGKozxZvHko8ulwqumL5GViPXHkuFaPjWUrvv5f5s3tfILXEge2850o4ecox8K8E2QOZXXMq/GKhsjQx+A3zS7n9EpIqVF2d2/hKQ7STbYIc+feJ06LZ2BCrhLfYilYjoglEa+g7KLKLyhLvEbiKOAK1LsJKEPE8Shg6wfvTIWADuqXGvpnLflpyNnG9DSsTPNxLNuYEizij2nt7AXLWrpCaGpBTV1pYLzXhkSY7ai5j6vhfKnphTWpQmo0k X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR12MB1671;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR12MB1671; X-Forefront-PRVS: 0401647B7F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(199003)(189002)(110136004)(50466002)(305945005)(7736002)(81166006)(81156014)(54906002)(6116002)(53936002)(3846002)(86362001)(8676002)(36756003)(66066001)(50986999)(7350300001)(47776003)(48376002)(6666003)(2906002)(101416001)(68736007)(42186005)(53416004)(5003940100001)(7416002)(189998001)(5660300001)(72206003)(97736004)(25786009)(50226002)(478600001)(106356001)(6486002)(4326008)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1671;H:gi-joe.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR12MB1671;23:T2LL6lYXXtd2KITp5VS9knT93UzzzmSRbFdp8YP3J?= =?us-ascii?Q?IkmuJ7fRKhPFOQNg4s2QMRxtubvYwBR2m/VNqP/bTIVEOWDjEF3UWZuABxYw?= =?us-ascii?Q?5Huq1WgnyRES90e2e8O8kdom6Ec/jBELzosFU30SgBsDsb3NRzp6MmftL6Y6?= =?us-ascii?Q?2KH4FDRbDabjBZJLnV5rljSmRh3C89d1jeAGFWq+7WzLg2CcNitxI8ZxN6Yb?= =?us-ascii?Q?/M0PxuSAirsYeW3sHYamFpNZG7tc9dt/+sI6AS1xcJfIk3AiaBaTgtaj/IAW?= =?us-ascii?Q?m40tH9qDXlgEUWXwuoSOFmm5IRAoEII7ujJWnnjvPbBL2D9+6/4Ky/Y1OVd1?= =?us-ascii?Q?tpXn73VqtvNlivFtpKQwFfvCJa5DB5yxOJ+YJxWHoLja250kURo6KXRZxNdN?= =?us-ascii?Q?YuFV9FDQcEMwwu2mCsW6H+2auoNMNMmyLwmSDBUAvaMcsGAtpSnqMJd5EScg?= =?us-ascii?Q?Cgb7AbDYfG/ytzeOSv+tCIhabedwths+wPqBdauV68HiNi6k02RYXFdY9aqd?= =?us-ascii?Q?C+C7CMlGwLneHAZWyzCMowqM0/R3CoA5fnSBuxwOzcHoUYLqhPrUbBd9rA57?= =?us-ascii?Q?RaW8aO/yKyh1kLB2zdhZ7vvZ/jp8P6iiwjxzqxos+l/P5tqc2CdB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dVhED7IK4QlnALlsMflvdw==;24:IB44+SiqeqicdcmvHVq2h04jtpNbNfKKcvbvpUMIbopjxSXyQolN3lBuP0+DG409IZbMBo8ekjhiZgjMnaFOaU/exEudwPENxjRP0zycL68=;7:rpbmQZCFTUf6YY6y1A79jSTjf2Sq4nbNFUKIRF/UpWOxo1jVPfGy7iVqbpcwI4mnYF7HJQZSOixcE+VRtBBvpbifpnvpU9IluauPpZBlu8PXvbzR1QNSVk56Rd+2879OV8oQ5xsJpJyZUFjyjXi1SRPicxgLvblFKmXdPGjZPx2gncR4OdyItCtBkfZ5Mk9QN397g9x1zKuk56RwoQWiBhjXrYD/oav8d7O069/HTj4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1671;20:pPROHWIR2nEb2iS+62ouXx+ocU9X4UYwXixbX3In46ABE2crL7piciCjcoqJQ6/V92CccpKjiSluBy6S4aiZO7BuE98OEFZrCZFDka1fuhXcTH+SWwCfedDEp1c1BIAKOH4OAJrzU2p7/lr4/oormLhAEGSSlGodWx3KDvuVXkXThfp9kjkaq97lnfp3Oe7TZlAGOjSY6v19kyCKFq8fPDoH1mx3oQ3Y74n7KTUTKYiZIWW04bFfD9hHdsgb9vcQ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 15:55:08.5182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1671 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1537 Lines: 40 This patchset adds support for the Virtual GIF (VGIF) feature. This feature allows the STGI and CLGI instructions to be executed in the Guest Mode and not require a #VMEXIT. With this, virtual interrupts can be controlled in the Guest Mode while still allowing physical interrupts to be intercepted by the hypervisor. In order to provide this ability, two new bits are added to the VMCB at offset 60h: * Bit 9 - VGIF value : 0 -> Virtual interrupts are masked : 1 -> Virtual interrupts are unmasked * Bit 25 - AMD Virtual GIF enabled for this guest : 0 -> Disabled : 1 -> Enabled When a VMRUN is executed and Bit 25 is set, the processor uses Bit 9 as the starting value of the virtual GIF. It then provides masking capability for when virtual interrupts are taken. Bit 9 is writeable by the hypervisor and loaded on VMRUN and saved on #VMEXIT. STGI/CLGI executed in the Guest Mode sets or clear the virtual GIF. The advantage of this feature will be the greatly reduced number of world switches to support the STGI and CLGI instructions by the outermost hypervisor at Current Privilege Level (CPL) 0. This has been tested with Xen, Hyper-V and KVM as the nested hypervisor. Janakarajan Natarajan (2): KVM: SVM: Add Virtual GIF feature definition KVM: SVM: Enable Virtual GIF feature arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/svm.h | 6 +++++ arch/x86/kvm/svm.c | 47 ++++++++++++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 7 deletions(-) -- 2.7.4