From patchwork Wed May 4 19:09:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 67173 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp358138qge; Wed, 4 May 2016 12:12:12 -0700 (PDT) X-Received: by 10.66.81.70 with SMTP id y6mr14409282pax.121.1462389132509; Wed, 04 May 2016 12:12:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d84si6182905pfd.66.2016.05.04.12.12.12; Wed, 04 May 2016 12:12:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755572AbcEDTMH (ORCPT + 29 others); Wed, 4 May 2016 15:12:07 -0400 Received: from mail-bn1bon0071.outbound.protection.outlook.com ([157.56.111.71]:32253 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755394AbcEDTLN (ORCPT ); Wed, 4 May 2016 15:11:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+VWZnUU8FUSN3TPr+kno9UPPmYS7IgJMrve1344wMPI=; b=v3vxtuuDpLNitNLYCacTc3Pvpdcfs7OfvY6nygVUssa2Vn137p3v4lzr0ssVMz6id6eRM0pqqV1Dsv8zISXAIFjCOfFMsUt7WqGjJ8TPZWFIYtAhuC1PpR7vi7VJsvSloVuj2nJMc5T46hcEZeOk9hZ1SgY8o6Qd22siIBYBPqA= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=amd.com; Received: from ssuthiku-cz-dev.amd.com (165.204.77.1) by BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) with Microsoft SMTP Server (TLS) id 15.1.477.8; Wed, 4 May 2016 19:11:09 +0000 From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit Subject: [PART1 V5 11/13] svm: Do not expose x2APIC when enable AVIC Date: Wed, 4 May 2016 14:09:50 -0500 Message-ID: <1462388992-25242-12-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BY2PR21CA0014.namprd21.prod.outlook.com (10.162.74.152) To BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) X-MS-Office365-Filtering-Correlation-Id: cb9de025-42d4-4d13-9dab-08d3744fdac1 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 2:uKaaYaQAo4BIQzKY4c+7TcqtbUBYiz0+CuCHff05jthwMvndWmLguFrFivQX/HJJ98q78W2VPxfSOIIWz0rIjrdlB2UpD7XW5Ukq1XZtCDF/OL11CVB4/ElE609PMKTWqJkW4q/sebJJv5XHs3NmZt7fFY3jzHMuNDE/YEIAqoI631hA3fL1H2mswNyZzGOc; 3:l0s9Fkb4Kl7IL49QL5eY1AhXlPKTduunvnjNBZ1xYrdejw1uzJgg7YqF+RguL9Vxa5cQcy+BIUugIzg4eTcM2Ot5bTT0Tcl1VjcZMrRiAYawuq4lAebTitHVC7pz75dg X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0433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sBlppFF2HXy5LsXDaKR7gjHkZs/2UycaO59V7rKSvyjv3WwNGA0Ik5zVaQN8cN0HMfSWI0rlF81s+N0E3vZYpzN8D/9ge8aHCZxnuE4xrtk9fLgU/1jHi2qL2dW3FlT0nQGfkNna5StK3OlKBi1ErMDepD4wOve2gtGVDQkWl; 4:alzk1InhmFLoTemIXHlBJqbz+spJcTuC/FytasfYcApWQic4RCjX9xl8yq/9XOXWG2vZ++DcCRQe1WlAuRPmaA9dur54jTbev7f3vu48O1PFcO2XWdeEelLKzDFxujHE5DGIWVLPkLxUqVO1WqDCNLf5CRaaH3VMCJE8R4JDSTbmT1zW+dAWZFWr3a9bUM0RQjOA3OqKFABmpd8YLuo4yEuOJq7Rxt1yI8p2fJaojEKbG4qU69r3VpaxZtDGcHN7D1gEUhmQhkpIOVtCIjyukj80VfvmVKfGqqH2jYIq50zHGWedg074Aixm1ygmH6c2vTPpQG4YG7yclxl+OybvAe/AIG8QPYQpE6z7pRzhZqBhdvGPXah1JWxm7+E6RMmu2gPaG2inYFJqFoRHxaAqiTq6bLNuilAt8t2xWZPkewIMD0i+j04OMjcXg3Uf6PBh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101528026)(9101521098)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BLUPR12MB0433; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0433; X-Forefront-PRVS: 093290AD39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(50986999)(76176999)(50226002)(47776003)(66066001)(229853001)(36756003)(189998001)(19580395003)(19580405001)(2906002)(2950100001)(5003940100001)(53416004)(2201001)(5004730100002)(92566002)(4326007)(5001770100001)(77096005)(586003)(42186005)(5008740100001)(81166005)(48376002)(3846002)(6116002)(86362001)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0433; H:ssuthiku-cz-dev.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 23:T7N8HnKB7K9FoNe4aTMOqCCdM6/FV0NssikORSRSSbXQIDqA6q62Ar9cK0M3JxLhnblrvxi4LJNE1A9snce9u44gqY0HLBjzEu+ygjVsqW02mYbq8l2mmG98vP+ewVyTm+pH35a91KHuOecu7ryBRnaUNkgRBsNXuSXRW0Uh8hGK1FRJPJ1bv7TVttQ05d4Sk0rZzvpaVUdRwQmrMhnJluaLdazQ2z/g8VhniE7WK23fOOiUnzp6FViERaa5AxVI6o4ZlDH36zxbTnlCSIl8/DO9TEj5Msz4sTVoUos0GFa12Za2+jMUhrepLd31tC4GoEZOUCnGLymr8n8UWtW6S9OX64sgFhBbBFDiNDErEWpafVUMQUDTsD7DZFG/f005ujEAxNpEfMQ3Vx3sU5euq3FLWV5qpSogsavGX310B5JWutU/iPkgRS6pMuM5qNI267gabb25M0kqgZl2fEhiXF70iVnt/A8cMIg1TJoqcsBQNvgP9KPA9kveKCVbT5ojN8FWYwy7LLv/iw85ItL3tIwXETW5PkW2dvrmLGBKx0QfmwuHLCD22glam2/0jSJcStMH2flBVuwuxk7CBebaq2PI86FdyQaGDI0TXGLmpiJuCHRoDMQKnIW3DlXiMs73pPzEQUejacD8KefxD0puwHLpHVvgBqNVmXH+tanVwQRMnsl246aYcYJxDnADqQ1AxSohUqXGjjKdnmHupalvQ2DnIQXUC0FYbgYUem0l8LZbsaCYaOHPgWi0YTH+VRRpdu5b/hTHHGLkrBtM2XtpbkwQsktv24ICw6fUvhvTHkPvATf73PC2FPkkyHdLSZ+YT8FZOp+L3w9hjNWR85Sxe3UtIjgrZ5Gz/YOFcg1UyCIkpgj8JLuN8HgBZHCkKREm X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 5:bdf7pPkEgkxuDZMaLQvmx4nW/yQ6lauGwyLyvDnvTk7WHStYJASSL/qtJd+sREuObm2RQKJ7LMZF0AT2rzvixhTtbSEKLMWReZarsz1+SL1Z4tLRGevvbt+0+LgGMwBt8TY1Ix4qNvAXpYsbe/pkIA==; 24:pLqqUmydyZ0L9Lk9QjqErEttEtnUyj86g/xU9KBS65kncrZI2BdJJ++jeWXJUsM4/UERMOTKj7hhUBDD0LDQ1vdLFQQQvHJ1u/SxHuR1PyY=; 7:pjemWpS9U3G+X+3fzTxKVIfmKs6SU3wJJhz2zWgjbL2FHt+l1ayAYW0rvviPpGfSQWA182kC/ToFOgcRZCnurHgNVOdxUM5JQxks7c5CGge+NpdTNCJfsaK6ZNEkv0qq6wI/oVe9tu/BrFRAMTMZCQNHk+A1UPdjpX2Iilzsuoc=; 20:hbYXBC2HJiuet8vUZVhJht63rpGJDZ7UU6ptfoDBGlQzMe/oOtyoThthvE/7+nzpfc1JyhCSCNnwjq0xGfJLM8yHRX7ZQ4mPyp3HasLRGAjKYElE7jzQY3u0lMUg946Sd/GycPFYJ155gBtVRjAum1hFRipj2URhSoTOgddwylqdkOyDw/f73H4yOnotg/avC/ms8t50UZAPz2DO9to5mV8b5xQW/ypeonKrediAN2NFzEFRcHnwRhI9k2Nsfb53 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2016 19:11:09.1825 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0433 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit Since AVIC only virtualizes xAPIC hardware for the guest, this patch disable x2APIC support in guest CPUID. Signed-off-by: Suravee Suthikulpanit --- arch/x86/kvm/svm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 1.9.1 diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 6c1d558..d35fd61e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -4571,14 +4571,26 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) static void svm_cpuid_update(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); + struct kvm_cpuid_entry2 *entry; /* Update nrips enabled cache */ svm->nrips_enabled = !!guest_cpuid_has_nrips(&svm->vcpu); + + if (!kvm_vcpu_apicv_active(vcpu)) + return; + + entry = kvm_find_cpuid_entry(vcpu, 1, 0); + if (entry) + entry->ecx &= ~bit(X86_FEATURE_X2APIC); } static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) { switch (func) { + case 0x1: + if (avic) + entry->ecx &= ~bit(X86_FEATURE_X2APIC); + break; case 0x80000001: if (nested) entry->ecx |= (1 << 2); /* Set SVM bit */