From patchwork Sat Jun 27 15:25:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beata Michalska X-Patchwork-Id: 191951 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1442843ilg; Sat, 27 Jun 2020 08:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmoso3zoAn2PZAbUlghonc3lV86QOEC5ZowCaGc+LW3DIu1QUZIKiTzOPuAKgtUcv51Thw X-Received: by 2002:a25:b3c9:: with SMTP id x9mr13938733ybf.203.1593271599439; Sat, 27 Jun 2020 08:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593271599; cv=none; d=google.com; s=arc-20160816; b=HI8QXBQL6qCG2eS/JaGjnMgf/YK0HinoDHXPSF5DIE4XhREUGT1h+TcZCnHK8ixwEB ybeY0jmU5Ilxo0tkEWhOe9KCvQF3W2SJjoCt+8p3t46ii7JoQytm8tL97tGOic2Iw+bD Tcao7Icg2dZMInK6vDuDItadrDJ85jKBqg9Jbzx3B7u1CjXrAQk3uixEn++4L04eHF23 tjv6w6mSDiN5TAyNaOTgdNDGscZGdcthncgzzxd1LlYTdVLSSeucWWfu7YHd7fgBw38S 6rI74TmI8sxsJlb0og7HNjvBSvVstftY93O15WDB2C+tlB1ecTqA0ygrogPab+TnGFwF phqQ== 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=/m5mkGKgtE7TjZA080Li1qh2nYl8NNeDGiBLeOpwFJo=; b=ZKwnkR1sBccxXKdC44fc2lKl33gbr++6slga7aTWUiHRLXm8MrcwbLTIlnobS7zgnJ jsftPfLyJjxj50XT0PZVobWS+MTyZ88o5kODGPJHkmmdzz556j1LRBS1RCuwToOtBMB5 LbDpceV03OEHU7uzuywOuHCcFDURnd/t/R8bm4tCQG3NYqHRNre/J6c1t9oLEVu1nXLS OY48+EQDs/KqxBC1E+yTwwrUPgqEKSXAJXlC1etF9ygXahi5EYLjkFCYI7fsqXs1j0VX sB43xurgsSBEmSDx0sfekLh5YRRZh1X8K4yErmZyivnQTsIUo1fg9z8t/7PkuId4EG+Q yzQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kNVe3GuF; 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 i3si29551329ybh.240.2020.06.27.08.26.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Jun 2020 08:26:39 -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=kNVe3GuF; 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]:43572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpCj0-0004J5-EJ for patch@linaro.org; Sat, 27 Jun 2020 11:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpCik-00049m-0E for qemu-devel@nongnu.org; Sat, 27 Jun 2020 11:26:22 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:41792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpCii-0007SG-85 for qemu-devel@nongnu.org; Sat, 27 Jun 2020 11:26:21 -0400 Received: by mail-wr1-x442.google.com with SMTP id z15so1002496wrl.8 for ; Sat, 27 Jun 2020 08:26:19 -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=/m5mkGKgtE7TjZA080Li1qh2nYl8NNeDGiBLeOpwFJo=; b=kNVe3GuFiUeXwCsfG2Eq5K2BglY0ES0Gr/INHyYw6t8an42v+tbRggl/WTBc64RC/n 6T0lJSR+QuMzKrhlQW8v4GQ8c6u9qRipzWcgcDUvxp6/jBwZ0b8WGkUYkj5jlcWv0yz/ 8apa/3iII9C6wrB6j/YNT7tewL7OUH3jUdxfOVZczIXyhRHyy6wLGdd6oLi23esux+jm VY0hRKOlYHB0lx/I5tWX9uzxDjpMYFGZjS7/sD3itt80DgFyLryPy5OmHHHqMB2zAATv s2SytPEIHifhLCnVIFKc7yJaPAfXrAuR6QlWQzwN26C7q8bZhzlfgEt2ayhejF8GMhC0 AO/w== 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=/m5mkGKgtE7TjZA080Li1qh2nYl8NNeDGiBLeOpwFJo=; b=sRgTW2CfzUF9khDOzKvHbnBfyT91R9BTP1pGQzHq+UDBnqDNN0VuQo5NlSz9gajflK goQwsV+pf6KSMDcpvAlhNcqvu1BVr3Oh3i9XWWVSfVPetwJu6F0XY6bj/SWqA1nTozez OEnCE3vAE4eTPilOFxA3EfcZN36rbKfia/tfKnxfmlh7RYR/m6VHU/32jkv76lrXf1xf ASzv/ACTeOJm/y885Eq+wloBnshJg0kNW6+DtTv/GKc2cysDJuXz2LX53In6mUIYv6wQ FjdqwIKVNced1J4VMdbYK4AIC4aaMfVU97CF+3ogN5jETuD0geEQhPA2Uo3TwHUQB+d+ Y9vA== X-Gm-Message-State: AOAM533PXcQNCC8KayYl/mGhHL6jckrY2R1tkg1HnwviUsRwkZtDUgX+ p8TKuAAB1s7PRi9dFvG08RErxXVRXTqIkw== X-Received: by 2002:a5d:43d2:: with SMTP id v18mr8780574wrr.196.1593271577800; Sat, 27 Jun 2020 08:26:17 -0700 (PDT) Received: from moi-limbo-9350.home (host-92-18-20-3.as13285.net. [92.18.20.3]) by smtp.gmail.com with ESMTPSA id c6sm20965438wma.15.2020.06.27.08.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2020 08:26:17 -0700 (PDT) From: Beata Michalska To: qemu-devel@nongnu.org Subject: [PATCH v7 0/2] target/arm: kvm: Support for KVM DABT with no valid ISS Date: Sat, 27 Jun 2020 16:25:54 +0100 Message-Id: <20200627152556.7391-1-beata.michalska@linaro.org> Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=beata.michalska@linaro.org; helo=mail-wr1-x442.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_HELO_NONE=0.001, SPF_PASS=-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. ---------------------- v7: - Rephrasing the comment regarding abort injection and vcpu synchronization - switching to struct initialization instead of memset v6: - replacing calling kvm_put_vcpu_events with an actual ioctl call - making the handler function static 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 | 2 ++ target/arm/kvm.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++- target/arm/kvm32.c | 34 +++++++++++++++++++++ target/arm/kvm64.c | 49 ++++++++++++++++++++++++++++++ target/arm/kvm_arm.h | 10 ++++++ 5 files changed, 180 insertions(+), 1 deletion(-) -- 2.7.4