Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7987212imm; Thu, 28 Jun 2018 12:35:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhm6qSqADRNrqU3d9u8AzSRf/mR3XntIGh1iLGfZeuQOJIycRxIabXqq362wqzfBvFcU8j X-Received: by 2002:a17:902:a989:: with SMTP id bh9-v6mr12011227plb.245.1530214519378; Thu, 28 Jun 2018 12:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530214519; cv=none; d=google.com; s=arc-20160816; b=NyZJJWZGvfOnidzhf46B798Md0pHf+RTAqYqIH/7Ob1u2NJjHOlf8pbbsfv4pv/Boi xjiIyhgkRpVFQJ7i6cVjnE+bGc4MAaOcj7RQlr49G7zEmmoEA+g65KLE7mSo3v/Ps7WM iT37S8E7rpO1XmizwQrC6fqS7+vASYQ6OpclCdTlnHDK547A4OQabMZCN2NL5jlFYgw9 MYYvqPI1shPGnvr02VUcgWLaN2mjEIS+AXPJE2Q2jAg7Fbdg3BLKL2DdPnK4qMaQgX0c a1PkYOFRL9osVZcoktdjuhlV7QrZSlgwcF1UDxgJ2SGJsZZ9uHyE7VKAtEMarPIu0uQw rfLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=NAIQQt9kgZtZIaZ65kgprDpZk69SC08jv71f1LlJiqg=; b=LPmPQnIeTjkiVe9vv7JJ2rlxHmO/Q1aRRvWcoFA++RJkRSNq4yaxkZlTxnbWwzP7Wc HPjRGtQGM3f9sPkshtrW4xomk9xOMd4Z5nxs7qb+MWbN8HJqi3wbb4l5hfbBn5bOZetQ yWLVCy7MeFdynIPZzS9mWiizpLSazZKl2T6xck8uG9jv1xFkqZxyhtAPba4TQ6bz2U2A eVyLg9aKfe994MEqZrjxOfo7sxK6OFUGeSmTvP13rjdIqzl2CwljlUn8AEtQ97QNWxVy pV/GsXvRKc605/qnZXG0qcJXBBXlpc6S5ALfAAcUZdFsAZYKptyuJfLH3+hwS6JEdmdf Ctag== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p65-v6si4971459pga.401.2018.06.28.12.35.05; Thu, 28 Jun 2018 12:35:19 -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; 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 S967575AbeF1RiT (ORCPT + 99 others); Thu, 28 Jun 2018 13:38:19 -0400 Received: from mail.skyhub.de ([5.9.137.197]:37044 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967479AbeF1RiR (ORCPT ); Thu, 28 Jun 2018 13:38:17 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SEVBtt_KE2vW; Thu, 28 Jun 2018 19:38:15 +0200 (CEST) Received: from zn.tnic (p200300EC2BD08A00329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bd0:8a00:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C6F751EC03AD; Thu, 28 Jun 2018 19:38:15 +0200 (CEST) From: Borislav Petkov To: KVM Cc: Joerg Roedel , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Tom Lendacky , Tony Luck , Yazen Ghannam , LKML Subject: [PATCH 0/2] x86/kvm: Enable MCE injection in the guest v2 Date: Thu, 28 Jun 2018 19:38:06 +0200 Message-Id: <20180628173808.25885-1-bp@alien8.de> X-Mailer: git-send-email 2.17.0.582.gccdcbd54c Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Hi all, here's v2, dropping patch 3 and incorporating hopefully all of Radim's feedback. Thx. v1 cover letter: there's this mce-inject.ko module in the kernel which allows for injecting real MCEs and thus test the MCE handling code. It is doubly useful to be able to inject same MCEs in a guest so that testing of the MCE handling code can happen even easier/faster. In order to be able to do that on an AMD guest, we need to emulate some bits and pieces like the HWCR[McStatusWrEn] bit which allows writes to the MCi_STATUS registers without a #GP. The below does that and with it I'm able to properly inject MCEs in said guest. Borislav Petkov (2): kvm/x86: Move MSR_K7_HWCR to svm.c x86/kvm: Implement MSR_HWCR support arch/x86/kvm/svm.c | 20 ++++++++++++++++++++ arch/x86/kvm/x86.c | 46 +++++++++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 15 deletions(-) -- 2.17.0.582.gccdcbd54c