Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754089AbdGXULK (ORCPT ); Mon, 24 Jul 2017 16:11:10 -0400 Received: from mail-by2nam01on0059.outbound.protection.outlook.com ([104.47.34.59]:4032 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753555AbdGXUIS (ORCPT ); Mon, 24 Jul 2017 16:08:18 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: Thomas Gleixner , Borislav Petkov , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?q?=5C=22Radim=20Kr=C4=8Dm=C3=A1=C5=99=5C=22?= , Tom Lendacky , Brijesh Singh Subject: [RFC Part2 PATCH v3 23/26] KVM: X86: Add memory encryption enabled ops Date: Mon, 24 Jul 2017 15:03:00 -0500 Message-Id: <20170724200303.12197-24-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170724200303.12197-1-brijesh.singh@amd.com> References: <20170724200303.12197-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0049.namprd12.prod.outlook.com (10.161.151.17) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76293130-67fe-4718-92ed-08d4d2cf19fc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB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t72+a3agK5J8qS6oP4L0EoYLuN4Y9HAORTrZHL334pdOljBblM3ms0k+KLinu1vtWZyuB+S1SpgYb0TQE165oIhTYyzYQ25ezn2r8FM1+7MKoi0hePsy2GqNdJQ3oIr0Sy5yUNUi47lOcd7AI7mETqJq+haqUDMWmnqGRMT7svYXFSYxzZ3tRbGC+Kifx3qmp8t4/AWTQOw2AFlK+Ojxqa1mQSEuqoQLaknVmT6G8yDFQrksQQFENMvbQq87UzpADKTmNqxwCPQK0VusULjY7JKUurvhvZ3yzjF9pYFFOEj/zU07RMCneRuxaGFj1AzkSAy34qLixBgfhTmXWzN67xyYI7/XLATc3cTOotK7C8DJn7oac/8p6KNXg6jQHTrkps= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:y96BJS1XVsTbfgfgoGFdV/NnkP/inkv6JUxFDXkVWu5Xy0saHIDzoqrLl3DNAzgAUk0gmtV4mmpbZr+dxK071uFjx6w55tBtcdcejQ5BuDoqU1wB4Ak9QB2wNUOS4wQDB837Chx4j1gx+bvrnG2kEfG8itpSDXq01FDRg0vg0XQzeh561AQWtO5q8gNSiLzA4Pz9oavbtby14Jox63+pujL5Bw23r2qFgi4nwD9SNe4jcb7bz85SVYlB9DUZzzziLvZ+1Tcj9nazsIfJrOs54032YqhfzXOlprIghXkDHavB4uzAS3+W6f655T+eLKz+b0p8J10wSlbLzJWGwtlraLRQtbFjyLADVrlQ2x4HLOcw/zcfRg5dM8mjLTUChhigPFJkfbbRYN3dpFOPYk6cZVAEfQ7IJsYwK+OdnmIjMqHQyzNGmoowoFVURfzOxuBjLEWYlhD0UzAVLlS4I5FEKGNj/mNyfbJIQcIkc/MZ/6PCIc07zcFCdGFILEHuM2AD X-Exchange-Antispam-Report-Test: UriScan:(767451399110); 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)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR12MB0145;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;4:SCd9f1lreYT39sCmSTfWb9RdB6X6Wr5Cm+N0vp5sqG?= =?us-ascii?Q?WuCxz+39PhfQXQNlZxBFlPP5WihXpRliVkLJDGs9/NpCvjdwA0oLvyYj96Pt?= =?us-ascii?Q?9kgW0vwrv2SeJrup2BaGoRbTdGQc0cFbvoR/AEsJEJ/91yNXq0p2UO8PhJvk?= =?us-ascii?Q?t8sDWEpGa+d4fDloxaQd3dKs5KfkeYScpvrF8T/VlUFyJAGt56YT6TzECK1D?= =?us-ascii?Q?sSVoWltm7aM0zPbUlxe6qPifLiOMZcSyCyAYjcnicLtFE92jYBXObBwUUzXI?= =?us-ascii?Q?v7ACwuopQ1mmiPEmhaHYyuPSH8irhtW2BE+XnbqLY4xrqed1R8dHZFbFR9sx?= =?us-ascii?Q?z0HsVGz8IKfCZdruMx1B7c3S/Wy0o3r2kje3j2loHuh5e0RiBfQhZmWZG6Zu?= =?us-ascii?Q?HP0pwdqcjpq88WF1eV12ayhqbOMTpAcPZB6TvsYqv5fBcYpvS/jJ/lWv2wQ3?= =?us-ascii?Q?sgXgFcwY9qUKQOXBe0TkBZquCu0pfQ6sYZyJSDu6D5tRiLr00/m4aYZtQMkc?= =?us-ascii?Q?PUPyQS2ub2hjR1XyTkiT1zPBZ6U2uWH3cnDNb2AfGA0VJ20doRJnkO0k/Yxv?= =?us-ascii?Q?GsMj1zSGj+sVcD5KVKbYsBicLttr4T5/hmF0FvGJ7eeAoM+rsf7QHyA+YA6x?= =?us-ascii?Q?EyNDL6QNBBdfyAaGy1IbCFeBPIk0WKtt3igAm1gMbfC1soDNMdToh6sEwe8Z?= =?us-ascii?Q?UsHSegfkgHi0KXAnaGiHXpmgdU/oK2wV4OOMCJpwBQ5gZ8xumwT6Hk6htnUr?= =?us-ascii?Q?957iYO54K0lOsnArqDrKA6zpu8PUHV1RaHboENfNjNDUTlveUv1DrdaOUlZS?= =?us-ascii?Q?4EViCxgXzE1neKZkdTm97g4s4R7+28vezLIxGgdefd5tCJkzuHPOVdYCwYu3?= =?us-ascii?Q?Gidi64ogCAwnn3PPp29msI8l9Wl4sJPO6oWxye1PNPKpvvUcY3XiCyPysaGz?= =?us-ascii?Q?LqRR8yf3JbqyopCByIAbd6FDyA9kToF20d1LJER/3GeS/d+dHAM38kWmfD4c?= =?us-ascii?Q?UYnOdJGYg1InhQPRG67f3FKW3J+QsHP+KxuTsTWmr11jqWFDkBUNMSgKktDv?= =?us-ascii?Q?RREczLAs/aR7ar9I0aJFIoYXV+S8QQAA7V8xdIhwNXZYOSmvyv5jzWvLwnA8?= =?us-ascii?Q?E3bfVTpKC54KMaOT5bYFWIqE3L1koPhv4DEdKjUNX/t9b0mh0wkHryvr/YaA?= =?us-ascii?Q?u6/or4mWGPGbS3QbP9hdeY3Cv9M56lFd7I?= X-Forefront-PRVS: 0378F1E47A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39860400002)(39840400002)(189002)(199003)(7350300001)(68736007)(53416004)(105586002)(54906002)(97736004)(50466002)(6486002)(48376002)(2906002)(106356001)(33646002)(6116002)(1076002)(53936002)(3846002)(189998001)(101416001)(6666003)(2950100002)(478600001)(50986999)(76176999)(81156014)(50226002)(38730400002)(47776003)(5003940100001)(86362001)(25786009)(4326008)(36756003)(42186005)(8676002)(81166006)(110136004)(5660300001)(66066001)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0145;H:ubuntu-010236106000.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;23:ZKEKLwnGelUV1LI/twZMKxnSJFJKshAxyNvaikp0F?= =?us-ascii?Q?SNksLdYb3p89OWSlNwmc2AzNgJ1GWFwPdUqzP015iBWGalmvICdemErsRUEo?= =?us-ascii?Q?FBFd/iW4XOAhwU5MhKLv1xlz7lcwGofExUL9hVu4C/QZNt8SemyUsArRv3I2?= =?us-ascii?Q?EbRVG3S5eQkB+OA9f/inbq48J5lS2DmthfG+rIc4qUj2s0I7Hzf+cXw3/+Hc?= =?us-ascii?Q?z0ZlcBRmPcAEDLLQBDuUcx0eiHm6H1H9cY/jmYqQcUYYb7hmzldREdA/gRhC?= =?us-ascii?Q?eBw+ZQ//rUDGd7regbg8nuhsg4mY4xU5vlPITfYg2q9ztzZ/bnhorxphx7RZ?= =?us-ascii?Q?kJ1gV0s4A0OjkwWYZx6h+GE/9zixyhA4p44QVYdeUoRl+H4v9hx0xvrTEhJQ?= =?us-ascii?Q?Q06BQCF7zLOWSrsWL68u9u0dlN1Z141G9QE9sqf0nMhHyerQExibUVgAzaPu?= =?us-ascii?Q?YnLDgVm7Oz2fbweePZVbid4SfXZ7f9dSchqITiQmhENDPkzgjLe4SFJG/8so?= =?us-ascii?Q?xbL0GTIcBjTVvWh6TJiiZFC1EN8/Cd2yGwzD3DzkSrJhuExbVDm1po2Q5Kdx?= =?us-ascii?Q?S9WwXJjsmcsmqBL3ZLcgvkYZAeE5KcG1EGSg38/9PZa3D3Fstb7g3FY+h42s?= =?us-ascii?Q?HOeXm6kUsJoYc10W/Zd4QHRn6cfUTKAqbvgPDL2cbJQ4EOCBxIfajqUCqqqh?= =?us-ascii?Q?v3gHrdmCykS969TSmCzorGh23IP0JTR4UtpQ11Fhja+wuo+tIpIRGfgWXfu0?= =?us-ascii?Q?9rb2Ma1h82RPKclbV809OL8I39piJ0Sw7+K84djtkvZFir8Tkf7pgtD7xyE1?= =?us-ascii?Q?R/zquMY5syzLmzf5zYFcLB4chDQEfac/3N+0z+wMRUIwjZd5e+VBbFUqgBpl?= =?us-ascii?Q?QM71DN4Z2wrdKbkzM9sYEo9X0Nv9ZvFI2VnCLDKlzK8bk5km5eNuzLM0/a/F?= =?us-ascii?Q?rLgD0243KKjyRMLd0CIhs0Ggw2lv3elohxcTRZDvi8WF7EguFnDhEGG2o3uZ?= =?us-ascii?Q?GntIzKHXXFF6xPKfFDsCym4ZpWKSXQO5YBjVS034DI2lF3f38mJD0GoZNYqf?= =?us-ascii?Q?sPaEeSa6HFAGq2Mm4MYebn4z19lGzgEkMXOAa+wzmy/CpwWdjuwwG3pDoKCW?= =?us-ascii?Q?itwNsJ1ioDEaG5sl451pdQ5/mkz/IAljuUFPSvsjQYnRz8ktDV6MILmre/oz?= =?us-ascii?Q?iKMoABiho9odM2MpFscyep9C8Lh7PWZSIG8c/lZCXFweDP3ZlX7VFh2yL1od?= =?us-ascii?Q?sbQAHsEvpH9PUOBiUckiJbqEbJPq8sauJmb7gQs?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;6:OlWpYBsfJjhMyLFkvc6AyXzm/aMiI19f3vDbF0byu9?= =?us-ascii?Q?RKglE+cTuHy+LTRqWcGsDkOI6uI8z8icBRy/Myua8KAVBar0UD62KZE0WuLY?= =?us-ascii?Q?CeF9C1LpW43JCqlZ3LQxWmGD5WfZsYz3NIHnDAO9eyEXxxOOXEK2NfCr66gc?= =?us-ascii?Q?GaEyFRsV6zmxz+OkPBSdN9QA72gLhhK+wWu3dk1jm98NmhbuYC+9FA2h6eWc?= =?us-ascii?Q?sQ8Cn7k4kE5NFjBQP6YBalAv7bt5xz7uaFBQH/PivCy1DXKn29VRmLPcoT/V?= =?us-ascii?Q?+nF713YG+uJOFownxGZiG78WWSvPsyEmc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ivASRXxTvjpfH2s0M09iPAEkXrk7OAeerZWRrExLP8oRP7j5Lp+hJ4LRmpH5qB3XFU4DkgljKF7+8SpWbBc0ZWotWrpnsny3u2XOdJk0CUb0/gJj7isOSQLZJLzbDEmJqEWpRYQgTJiIcP1UIxK4tiZvvL+wYBJrDhSYEZC4tIFcmOKKcH3bSuLanTNRkie7Vj9Flj/pf2SoIJB+AylD1E1hV5laDN3oCqCJuLn7Jj2MYMILeC+5oe0hzt9gptt53ivfcWT5NqIopRCtazrsobdbVMUK/4TApvFdW0h6QuqQZsuUFUVWXocFXv4BbdqSkrGNZe22OpaO9DScENlI61tHjyvLpqUi15jcGbsU;24:04tNmCPIcLEsfKPTOQduwa9WLl7sRWfNjjf4XEU8GqwSWD8fb7t+SSAzdhwzb+5UnNFbly1zw2++XR14J7oNC0lw++W8ANuxVa594uS14LE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;7:UtjN4G3qo1uHUcyHD+KjyhaViEUVY/G/lNySkE1t8pfjJti5AzXT0tucRzqCbEJBcox1SeZbPF6TYjqI/kaH++QKvW5FM49TYlHBvruYriqQeChFLjOejXvn+lBNR/eun/fT3WWARNX3gAsVjxooScLwTwsZdu6L6F5FPJTowwVRiTBbuDYp/SZnMsg6uspa1CpVzXqFldTRW12B6IzlY2tO4DUPYA/h3L+ah6CE7RWoH3/CCWM7RwBUKoR3KK6HOWzKCXmgUqe3IvR1Q5w/BxZKSAb43LrPtwJBBeRyW2U4e5baefWzkuGa9Gzz8Lj9l43/inPJPi6E6m4C9p58AeTsbNrEWZ1QcYN2+Lc2nplLh9cIdI/389tC7jXM8CcJ47x25M7FxxHi3BFTfj5ySA33qxHtkLb2F3mSWxE9CUDDRRRMOwp/HvMrNcOtOIcciNWVl5mt5frY2frTexNnLphutypes4zy+TObTOdrca2POFOgQdwh6bdtrd16jpe/vi3Zo+wOrskfoKjdum8+mrcuASofKXje/vNGavrDUndOR2w2NbZ9Shfatw+YlBjVUUhzKVMlAt+DUkgIE3l+wfDsWsyOpT8KSkyTVwjCpNz4rVo0G+Yahf86vuFArD6pTk/WcP8P3P8FsrvMZN0TpSbKaOfnRVz3dNEYXdJeX4hcXE14C30AbpJQ+WOeB3oWL1CLm7DsWaLtwMXy3hbZWu/dgaya9U7/hCaNfFuO5ocicnZqm8jkMlHvwMYcsNHx4k1Ksb92UEhP3HvyeSzNCCVLM/Efr1yWdZ3/tYYeaOU= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:c7C+Au9EUKdWgVCvsbEqg+nKBqfokTzPIYpwWnCtQvJsZHIt1EJWdwRXkbbZ/Jk40YO2qBfd2QxCIoXKDGi6HM4yoiypBpG1YChcMVU2TAIx5R7GhSigQRc3T59ehgMN//TDWfyMkdY7p3/67/PKsSl6EjZzlG7G/bcfhR0brnkDiTsF8DRY1WscfqZHn85cH5yuNx5yU7nL9MOgKqePfjBujAjX8i7aLFa9zBK7DglCH00mj8iLBWc64VrsS9ki X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2017 20:03:49.2597 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1656 Lines: 49 Extend kvm_x86_ops to add memory_encyption_enabled() ops. It returns a boolean indicating whether memory encryption is enabled on the VCPU. Signed-off-by: Brijesh Singh --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index a91aadf..a14d4dd 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1073,6 +1073,7 @@ struct kvm_x86_ops { struct kvm_memory_encrypt_ram *ram); int (*memory_encryption_unregister_ram)(struct kvm *kvm, struct kvm_memory_encrypt_ram *ram); + bool (*memory_encryption_enabled)(struct kvm_vcpu *vcpu); }; struct kvm_arch_async_pf { diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index cdb1cf3..0bbd050 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -6548,6 +6548,12 @@ static int mem_encrypt_unregister_ram(struct kvm *kvm, return 0; } +static bool mem_encrypt_enabled(struct kvm_vcpu *vcpu) +{ + return !!(to_svm(vcpu)->vmcb->control.nested_ctl & + SVM_NESTED_CTL_SEV_ENABLE); +} + static struct kvm_x86_ops svm_x86_ops __ro_after_init = { .cpu_has_kvm_support = has_svm, .disabled_by_bios = is_disabled, @@ -6664,6 +6670,8 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { .memory_encryption_op = svm_memory_encryption_op, .memory_encryption_register_ram = mem_encrypt_register_ram, .memory_encryption_unregister_ram = mem_encrypt_unregister_ram, + .memory_encryption_enabled = mem_encrypt_enabled, + }; static int __init svm_init(void) -- 2.9.4