From patchwork Fri May 29 11:27:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beata Michalska X-Patchwork-Id: 187299 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp492143ilb; Fri, 29 May 2020 04:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykjS8jamvuzcX2ItOvpvpwcAWvU4W3QaIcKxWqpXAOyUhPyE5rGXj+aNjxnmHhot+hcGBE X-Received: by 2002:a25:cfcb:: with SMTP id f194mr10794664ybg.56.1590751749150; Fri, 29 May 2020 04:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590751749; cv=none; d=google.com; s=arc-20160816; b=mBaK2YXH0UJ0fgDc1O+wzbgUuRCPMwnBvC7no8azJvPvJfKIvSW62M6bu063HYWMIr yNhe7hne2/9RYaEqsBGzn+65WpsiqJXSaI3V/ihwgpUnXracQa+SoF/buXvRYewoDPOK 9jOJrBGfm0GOui1NE38HIOSJojxMwDUEYiJ/vxlSZHgRiJXJaZqvEowGECFm1uH/YnJ/ 4EJNfsRvBEg9ilsYglo2mqrbDx4W8eYnRnUp6b2dyg169qEBhQLQUlRxMLyvjIin0TD9 EUTvePEuWW4zhCPwJv+M5bKMMLEiXvEzrCHf3UjDwHoXCqGmQ1A06rY5iRLhEQcBuRZY rNGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=wKZ/XG+QT1qtovyr0q0rEdp/rI8bv2otMbHbRlqHsoY=; b=N/wLSgyqYQ75Snl2vvHm4mIKSaF8uV/yubqTy5CrNWIzt+KYS28guvBc+siA7vbUeX G+2mxmYrHdgeRWhYWkzBEzheC88WPfNLgd4ee5rN6mS8ElVlh1fhMcMfmF9Qnn/3WPXk RxIcoJss7iH8Uwhy9C4+dFWYP/32LFKXLDH8IUtPYcf4EVaczCC5LaOTu5OoU+zJhTNA ka3Ks5t/3DqlEYC/ziXhG0doyAbKXBlE/42GHkXrbnRFF1ihlQoDslO5040DG2Guq1q7 TJOvswbvpP7oSzjIjNQSFOPtTeJYH7knMMuAPhYxKA/lx/W1gPW7qKNE/Sv1o533XmOy M4yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="mkVlHAR/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z8si7538852ybm.9.2020.05.29.04.29.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 May 2020 04:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="mkVlHAR/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jedCG-0005kc-M3 for patch@linaro.org; Fri, 29 May 2020 07:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jedC1-0005kI-OY for qemu-devel@nongnu.org; Fri, 29 May 2020 07:28:53 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jedBz-0002vq-PD for qemu-devel@nongnu.org; Fri, 29 May 2020 07:28:53 -0400 Received: by mail-wm1-x342.google.com with SMTP id k26so3040363wmi.4 for ; Fri, 29 May 2020 04:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=wKZ/XG+QT1qtovyr0q0rEdp/rI8bv2otMbHbRlqHsoY=; b=mkVlHAR/W7MuyANeOmDncItez0ATFdX67xIGtWfurGN7edQgrFjFgR09qFnuYJh23E uo2Lyg7h+Ba0/MF9oJa+0DE2OiK1yMeZCvxCWTsVr+Ydsc2wUWrTZiGrTgmNwhW6qPcS ZonLbKoDeFXRVYmIH84Wn6/qKuq0TKCBCLCjkkKkNBqHGe0qYAcNCy+yshzLNjrnSR3t zff+tj5yCvnPDFsK2oib3Lz9mGgx2OoTrav0WCXH7sXQlSLTP91UAcafNyo7lNBclrIH ISLqgCiwhIPSwwBj9qxjvUmk/9O4ZIR2q2S9Z/pT9vE+xbpxnqt5MFfytY22JWAr216l MAdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wKZ/XG+QT1qtovyr0q0rEdp/rI8bv2otMbHbRlqHsoY=; b=P9tch3cR2pVzhbfngZWA0iiiHC6Y4AE19fHRBL+5vJCOpi5ch1u4Ur71vbkxaqBrPA ZxlNACk5UHmOTO/YH+3ATRtEW0qr5dh3p/FgwMkrk10zQOVseiTfkpt/x6KAUuP8p+j4 HMSTZBQNZczJEnaaz/cJOk7S78qqy4r5z9xUpzfZ5xVx+vjCY0v3RXqxqlzXHyRCK1HL VtcB0wJB8qARhKz0P3GWiNI63TY6U840Rhz8FlJTryGG4SZwu4/AeDhGic7x+oZ2UC2t wKdtXIrkp67rpsAwuPhRos4Zpg9fT/B3qPpl1mTFwXJo/3hzvufHnbVavyaGdkvBAyBr Zxxw== X-Gm-Message-State: AOAM532kvomgvg+MBFeLWb0Yldccu6Cd2+87s94LH8G1mBMRlky3VlET elaKgh1hkw8WCLZS128PtzYzH8LjhutprQ== X-Received: by 2002:a1c:e389:: with SMTP id a131mr8436784wmh.46.1590751729031; Fri, 29 May 2020 04:28:49 -0700 (PDT) Received: from moi-limbo-9350.home (host86-151-121-39.range86-151.btcentralplus.com. [86.151.121.39]) by smtp.gmail.com with ESMTPSA id h188sm6449053wmh.2.2020.05.29.04.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 04:28:48 -0700 (PDT) From: Beata Michalska To: qemu-devel@nongnu.org Subject: [PATCH v5 0/2] target/arm: kvm: Support for KVM DABT with no valid ISS Date: Fri, 29 May 2020 12:27:55 +0100 Message-Id: <20200529112757.32235-1-beata.michalska@linaro.org> Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=beata.michalska@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, drjones@redhat.com, Christoffer.Dall@arm.com, qemu-arm@nongnu.org, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Some of the ARMv7 & ARMv8 load/store instructions might trigger a data abort exception with no valid ISS info to be decoded. The lack of decode info makes it at least tricky to emulate the instruction which is one of the (many) reasons why KVM will not even try to do so. So far, if a guest made an attempt to access memory outside the memory slot, KVM reported vague ENOSYS. As a result QEMU exited with no useful information being provided or even a clue on what has just happened. ARM KVM introduced support for notifying of an attempt to execute an instruction that resulted in dabt with no valid ISS decoding info. This still leaves QEMU to handle the case, but at least now it gives more control and a start point for more meaningful handling of such cases. This patchset relies on KVM to insert the external data abort into the guest. Thanks for all the input on the previous version! ---------------------- v5: - Drop syncing vcpu regs in favour of calling kvm_put_vcpu_events directly - Fix decoding DFSC for LPAE case - Add/clarify comments - Switch to reporting error case failure when enabling the cap v4: - Removing one of the patches as it is being picked-up separately target/arm: kvm: Inject events at the last stage of sync - Moving handling KVM issue to a separate patch - Minor changes wrt the review comments v3: - Fix setting KVM cap per vm not per vcpu - Simplifying the handler to bare minimum with no default logging to address the potential risk of overflooding the host (adding support for rate limiting the logs turned out to be bit too invasive to justify the little add-on value from logs in this particular case) - Adding handling KVM bug (for small range of affected kernels): little bit of trade-off between what's reasonable and what's effective: aborting qemu when running on buggy host kernel v2: - Improving/re-phrasing messaging - Dropping messing around with forced sync (@see [PATCH v2 1/2]) and PC alignment Beata Michalska (2): target/arm: kvm: Handle DABT with no valid ISS target/arm: kvm: Handle misconfigured dabt injection target/arm/cpu.h | 3 ++ target/arm/kvm.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++- target/arm/kvm32.c | 35 ++++++++++++++++++++ target/arm/kvm64.c | 49 ++++++++++++++++++++++++++++ target/arm/kvm_arm.h | 21 ++++++++++++ 5 files changed, 199 insertions(+), 1 deletion(-) -- 2.7.4