From patchwork Mon Sep 19 05:52:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 76503 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp794742qgf; Sun, 18 Sep 2016 22:56:10 -0700 (PDT) X-Received: by 10.107.22.196 with SMTP id 187mr33623963iow.193.1474264570639; Sun, 18 Sep 2016 22:56:10 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u139si23854009itb.99.2016.09.18.22.56.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Sep 2016 22:56:10 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@amdcloud.onmicrosoft.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blrWQ-0004MZ-RV; Mon, 19 Sep 2016 05:53:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blrWP-0004LC-3O for xen-devel@lists.xen.org; Mon, 19 Sep 2016 05:53:41 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 97/64-12285-46D7FD75; Mon, 19 Sep 2016 05:53:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA1WSa0gUYRSG+2b2Moor467haXGjBk1TvJWFJWU ihYpC0A8hAh1tcpZ2vcyMtVmClalrJoIQuG14TU39IQa1KEiKmVsYpT+8oqCBYl4ru4o006xm 8+ud73nPeb/zcQhcu6zUE4xFYLgs2kSp3BVsWGBiSEbBTEp46SMqqnG9QXEGxb/q/o2dRxeVx qz0bEuakh1bHlfltAZb7N/asEI0TJUhN0JBFuHQ88EgaUSmwspMrbIMuRNashCDyZY+TAIqMh oW7VNqSXuTBmgrs6slE06WIKj8OYokoCPjoWe9AS9DarGrPyyBdKohk+Bh6WOVpIHcD86BKqW k3chkmJ8dEisJMSsJ5juCZbsXOKs/KiSNkwC9Cwu4XEpB9fNClZQKZDECR3v9X5OWDIKR/l5X /2QY6mzGZdN3DDZ6JlzV5+DdwCAmgzoVrN7Zcv08UcHSULlCdpngx7RVLesouF+3iWRTH4K1I Qcmgw0cnq4LsvYFa3+5WjbdU4JjzOYaKBV+2eNkT6MHVFn9Zc+kGjofFCnk59LDqsOJKtEh26 7BbbsGr0VYKwrgGe4aw4VEhqZzxkxWMNNGU0hE+LFQM8PzdCZjotP50IxscycS12CP+DnQREV cH9pHYNRejUOYTtF6pmdfvsHSPJvK5ZkYvg/5EgQFmtu3ZlK0XhyTyViuGE3iLm1jIDwob811 CWv4HNrMGzNl9AYd1PtovCVASoDNy9op297CYWTQ6zRIvIjWI4fhzEbhf76IfAhE6TSDN8UuH sYsYaf7ohiMicFttkkpWKD/IX0h6qpciE1qyc2eiCk58umSZ/uJirC68bTKyK8Few6krgUE1q uv1iQk1uje1gTxMZ+bjr7uaDXlT02HJZwdnWF8NnULQi6Fz6pP1zpH1orZ+eam4K6VF9qT8b3 +7+Pmqg3Bgz3PYjld9Fav39zGXPdYgvDlwssm63G/zvx8y+G7/acoBc/SEUE4x9N/ABACiI2A AwAA X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1474264417!44189674!1 X-Originating-IP: [104.47.40.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19450 invoked from network); 19 Sep 2016 05:53:39 -0000 Received: from mail-co1nam03on0074.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) (104.47.40.74) by server-2.tower-206.messagelabs.com with AES256-SHA256 encrypted SMTP; 19 Sep 2016 05:53:39 -0000 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; bh=gPe0Mb6vpxycXYpnXD0waFkwMV6SFif+JDuOzpFrtO0=; b=JQwKsqN39+LIE2TpfPkNjWaZ7a8SE4Q/43Mht/G7qqV1/GDOqxvILX7n0OmbOKWWiiohkFhl2jgFQTafKuK41eb4UwAyLRXIUX6lPtQofSQOq8x2NyFFqq25eqf5PAvG6neLEKdKeqxoRgeV0l4/CwnoggGmjsiHtwX2fuKM2nI= Received: from localhost.localdomain (114.109.128.54) by BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Mon, 19 Sep 2016 05:53:33 +0000 From: Suravee Suthikulpanit To: Date: Mon, 19 Sep 2016 00:52:47 -0500 Message-ID: <1474264368-4104-9-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: HK2PR02CA0002.apcprd02.prod.outlook.com (10.163.104.140) To BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) X-MS-Office365-Filtering-Correlation-Id: e5101e03-78c4-4bd7-df50-08d3e0514c04 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 2:3k3z44COOC/AKF5Na4ganyJGM8rY60JQ+yE9yiXmhvKkyHvfvlxH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oJ1JfGhbJsC9PMtPC9L2TJwukrzByQHvMrgt3tp1JQ= X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 31:qT/YGGg/Fo46xX7vdh4gD4O2cCuJngtjHFWZGpHZDj65px0eN/PsGw8f4/aAYj+ZaO8LR4yO6L9/xKpbI2nLX6pedtEG6W9XOokYU3HAXtL/KetA3Eciy0U7gYoKU8qLt9giCBkpNr24o5qiQGGESYOz21KphghlfcNHPXTkB8AZt51GQ5bMAeJmQ02m4XEnC9JH8XN1of9MrpnP/0ZIN7jGUevO/H6HcGPl45txZVM=; 20:l1velLUd3eLLPcBA1WRg5525l828Tvl7zXCdWdQ6MMo0oyZYsTbLSMaX9i7GhqSxuPhiH+P1/eZXEcEa4z8eRhC5ZGNiVeb8ybCNhGMe6mvergzEFom7kctpvKwKSVBIYlHGniF1ZXl1M7tZ7GiXS0wVTPk55B8VlvZgS00b58gI8JexSw3wsffTbSNwB4b5m79UX4UHaBHEa9S9VXK+Pe1SIv6WvIUf0ZnsbCZKtGWZ1ToZslDmjtesK0Qg+eBajfmQTGpwcpGDNrdrMBg5jEWyKjT3UmkSneHL8yxoIXDr3AfnjJDnJE/te2D962aMNpoDlY50/5DPNf37iG9fIHKkIgagqQGlCOIKotwGO9Kk5dRSl7+RxuyYrpw2mCsaqHvo0ouSWD744CxV2QKzEja0g7dhnvSs/onc3Hv73W3qOYKMHnqtMYtUXQxNd6YhqU000NRLAbhMH00it0I7MLTAw5d4Or+d4pWffNpa9tzX7a+SFvZSzuZqobGZQbSU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BN6PR12MB1442; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 4:+GkNRuXuIx70ACc1/JsmDaxSxGohiN8lsgQ44i5GiKI13LDtZtTQukhwu+vsMu8s2IlJlfA19Ux5gy6kK6N+ZQwZ9lG+sq9GcdaNab38mUlQokCs2DRCtoktJcC06n+H1hvIkzNNbhwSn5LrIETun7S61Xpl7dhFsclswc5mBf/r1ZWbvc6F7XWzcu+M/JHIx3ouoq3k2f987PjnOGS79TIa1aYHQzE3Kr9veKQDKD82cu14nAfYR5MlnqwYZyYs/ZojWM30bfH/7mUqGHcYW+8j1bEFQyTgpH88OhgWQw+HNp1n602JyzSZeRCURvfOK/b5ur7u8j3scNXfgugeoj4Ibk/kLIIByDRTNBFqRQA43PGqKTlPVtD/3SA7byzgTDa84yPZJpJIM6jc19MpTmW+Bkqn0E8sJiTDEPDTKguu2cxoG9/nu6v9OS02leD5 X-Forefront-PRVS: 0070A8666B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(2351001)(229853001)(5660300001)(81156014)(81166006)(33646002)(8666005)(8676002)(19580405001)(7846002)(5003940100001)(7736002)(19580395003)(77096005)(305945005)(110136003)(2950100001)(92566002)(105586002)(106356001)(101416001)(2906002)(586003)(86362001)(4326007)(6116002)(3846002)(42186005)(66066001)(97736004)(47776003)(50986999)(36756003)(76176999)(48376002)(50466002)(189998001)(68736007)(50226002)(7059030)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1442; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1442; 23:IYd9bm8I6Qtw3CL1cP+/NufhGi5J3Uyc+dZiZW3AX?= =?us-ascii?Q?5/jKPxfSAX/0UZj6ah90vxfL9K5FVCN+qYCipwsarClmClap0MpmzHWbYbWl?= =?us-ascii?Q?HEzvViaxbueK7NBwQQgrK0zOfBkhFJ7HDLXw+4Zq3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fPBCE0I6G4rol5/X5cb8H2VpDiI4DthA+CX5S7Wqx9bjYRpblQ+QfnO6DazUC3Nv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 20:aKAwue0kx6XVBkBIQ+T3CQsKTneMcabB21u1AaYhFMJ0whAPTrjCfUCqxBfHGC634iQSIvExrfMSVhx2uBiIxnF67PVb9IOv9RsV8uZmP73G1qVfpjDkUIvTykHYJkDQaxESwkaVlclLX1XxAMAGs2YVSo5R24VHb74ZedJ96y4VxI/GuIqVxXyFAgYrf6NhqYhXdm2zBgZZ2lzESVYyYK1b4W+PFvL5YdZoeGXlPF9WNr6xFdiJBhivrEpb5kjb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2016 05:53:33.9944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Cc: andrew.cooper3@citrix.com, Suravee Suthikulpanit , jbeulich@suse.com, sherry.hurwitz@amd.com Subject: [Xen-devel] [RFC PATCH 8/9] x86/SVM: Add interrupt management code via AVIC X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Enabling AVIC implicitly disables the V_IRQ, V_INTR_PRIO, V_IGN_TPR, and V_INTR_VECTOR fields in the VMCB Control Word. Therefore, this patch introduces new interrupt injection code via AVIC backing page. Also, the AVIC hardware automatically synchronizes TPR and CR8/vTPR, when values are updated. Therefore, xen does not need to handle this when enable AVIC. Signed-off-by: Suravee Suthikulpanit --- xen/arch/x86/hvm/svm/avic.c | 31 +++++++++++++++++++++++++++++++ xen/arch/x86/hvm/svm/intr.c | 4 ++++ xen/arch/x86/hvm/svm/svm.c | 12 ++++++++++-- xen/arch/x86/hvm/svm/vmcb.c | 6 +++++- xen/include/asm-x86/hvm/svm/avic.h | 1 + 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/svm/avic.c b/xen/arch/x86/hvm/svm/avic.c index cd8a9d4..4144223 100644 --- a/xen/arch/x86/hvm/svm/avic.c +++ b/xen/arch/x86/hvm/svm/avic.c @@ -576,3 +576,34 @@ void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs) return; } + +/*************************************************************** + * AVIC INTR INJECTION + */ +void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vec) +{ + struct vlapic *vlapic = vcpu_vlapic(v); + + /* Fallback to use non-AVIC if vcpu is not enabled with AVIC */ + if ( !svm_avic_vcpu_enabled(v) ) + { + if ( !vlapic_test_and_set_vector(vec, &vlapic->regs->data[APIC_IRR]) ) + vcpu_kick(v); + return; + } + + if ( !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) ) + return; + + if ( vlapic_test_and_set_vector(vec, &vlapic->regs->data[APIC_IRR]) ) + return; + + /* + * If vcpu is running on another cpu, hit the doorbell to signal + * it to process interrupt. Otherwise, kick it. + */ + if ( v->is_running && (v != current) ) + wrmsrl(AVIC_DOORBELL, cpu_data[v->processor].apicid); + else + vcpu_kick(v); +} diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c index bd94731..876d2ad 100644 --- a/xen/arch/x86/hvm/svm/intr.c +++ b/xen/arch/x86/hvm/svm/intr.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include /* for nestedhvm_vcpu_in_guestmode */ @@ -101,6 +102,9 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) HVMTRACE_3D(INTR_WINDOW, intack.vector, intack.source, vmcb->eventinj.fields.v?vmcb->eventinj.fields.vector:-1); + if ( svm_avic_vcpu_enabled(v) ) + return; + /* * Create a dummy virtual interrupt to intercept as soon as the * guest can accept the real interrupt. diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index aafbfa1..caf9984 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1091,7 +1091,8 @@ static void noreturn svm_do_resume(struct vcpu *v) hvm_asid_flush_vcpu(v); } - if ( !vcpu_guestmode && !vlapic_hw_disabled(vlapic) ) + if ( !vcpu_guestmode && !vlapic_hw_disabled(vlapic) && + !svm_avic_vcpu_enabled(v) ) { vintr_t intr; @@ -2337,7 +2338,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) * NB. We need to preserve the low bits of the TPR to make checked builds * of Windows work, even though they don't actually do anything. */ - if ( !vcpu_guestmode && !vlapic_hw_disabled(vlapic) ) + if ( !vcpu_guestmode && !vlapic_hw_disabled(vlapic) && + !svm_avic_vcpu_enabled(v) ) { intr = vmcb_get_vintr(vmcb); vlapic_set_reg(vlapic, APIC_TASKPRI, @@ -2530,6 +2532,12 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb); intr = vmcb_get_vintr(vmcb); + if ( svm_avic_vcpu_enabled(v) ) + { + gdprintk(XENLOG_ERR, "AVIC VINTR:\n"); + domain_crash(v->domain); + } + intr.fields.irq = 0; general1_intercepts &= ~GENERAL1_INTERCEPT_VINTR; diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index 9ee7fc7..9ea7627 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -93,10 +93,14 @@ static int construct_vmcb(struct vcpu *v) vmcb->_dr_intercepts = ~0u; /* Intercept all control-register accesses except for CR2 and CR8. */ - vmcb->_cr_intercepts = ~(CR_INTERCEPT_CR2_READ | + if ( !svm_avic_vcpu_enabled(v) ) + vmcb->_cr_intercepts = ~(CR_INTERCEPT_CR2_READ | CR_INTERCEPT_CR2_WRITE | CR_INTERCEPT_CR8_READ | CR_INTERCEPT_CR8_WRITE); + else + vmcb->_cr_intercepts = ~(CR_INTERCEPT_CR2_READ | + CR_INTERCEPT_CR2_WRITE ); /* I/O and MSR permission bitmaps. */ arch_svm->msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE), 0); diff --git a/xen/include/asm-x86/hvm/svm/avic.h b/xen/include/asm-x86/hvm/svm/avic.h index 2c501d4..e1eb66c 100644 --- a/xen/include/asm-x86/hvm/svm/avic.h +++ b/xen/include/asm-x86/hvm/svm/avic.h @@ -40,4 +40,5 @@ int svm_avic_init_vmcb(struct vcpu *v); void svm_avic_vmexit_do_incomp_ipi(struct cpu_user_regs *regs); void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs); +void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vector); #endif /* _SVM_AVIC_H_ */