Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1219772rdb; Fri, 20 Oct 2023 11:47:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9XgnF/t5XyrjkjGgnacRcir3F26+BSMT6uSJZ6I9sR2hIjrX6zYu5l4ZsvGd6JDgw91wg X-Received: by 2002:a05:6a00:24d1:b0:6be:2720:16a5 with SMTP id d17-20020a056a0024d100b006be272016a5mr3013168pfv.33.1697827619570; Fri, 20 Oct 2023 11:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697827619; cv=none; d=google.com; s=arc-20160816; b=wrch+RahtX3IdNPIX4OPNc533pmVBTOQlxkbVUfSu3PKMpbJ4y5xsgVv/Eaq7WRlQt go4eONMKOy1EBLvTB5WJmkkSUTB5xoj2cEFgrfWwmxEHmYPa9qCQlQGjNOZ7shzCf9vP lPjYntQavrpYBuaAUTdTfBt9iSeeT2R7JhPRFW0pTa9+ybsoLM6DFEArtJ1ml5UhWVGs 9lLlJUmFE27olxqVQ87kUWWKyT7GPHZin25/QRYwmSO1tV+gZ2kYKM9aTXvfbDspOnTq awaM9KqZ2vbOe7WDhVXuob6oxys09hO6wxrt0/OiV+cvyfNjVYubg24gtp4BE1fLSIsS wWhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=ZfFMOnzOWPDFZoMZUine3Kwx2BGR2wcwPk9fcWx+DPA=; fh=LwOkd6dqkuR6TBmAT6jsVIsYbcvxo+97cOlDQ/cJp8s=; b=aGxv5uFOq73GmXeeD9+BBt3JJv5UgFPV7KPRkRwhN31YFatzVZOnUNiQHdpywy0Hty rlPWLai/mRhgXEXukdSllw5SMKH0z9BQOQgGNwjyzfzy++QSGUKd8pQ/0OGlwklFxnsl fZdbFVUVd3clzxEtm4uIY0QeUjYBta4ZPwhTezda7OIyHqPYDqaFvGJu3oJjHOmm1oSp 6hTBKBnWKKW0KaLULNd4efiKGGH/DSXHs/T+DBdAE9vGBpDQp12+ej157EMqy9zKzCcl 6mSL2pvYDTq2wWpCMucA3lhDHZjjLznaM2m+nzsNQYjncmG4Yb7zvByTGEEKAR0L6eZX 2MCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mwa.re header.s=google header.b=L15wBn68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mwa.re Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u83-20020a627956000000b006be2d998584si2392791pfc.47.2023.10.20.11.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 11:46:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@mwa.re header.s=google header.b=L15wBn68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mwa.re Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C68ED8075020; Fri, 20 Oct 2023 11:45:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbjJTSpW (ORCPT + 99 others); Fri, 20 Oct 2023 14:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjJTSpV (ORCPT ); Fri, 20 Oct 2023 14:45:21 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C962A112 for ; Fri, 20 Oct 2023 11:45:18 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 2adb3069b0e04-507c5249d55so1578627e87.3 for ; Fri, 20 Oct 2023 11:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mwa.re; s=google; t=1697827517; x=1698432317; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=ZfFMOnzOWPDFZoMZUine3Kwx2BGR2wcwPk9fcWx+DPA=; b=L15wBn684gQRLC5JIbKGasf3N1ll18iVnrooVbnkwqU6SJ89TuSKz67/zlcH4jinmv vFtBN62AMRoEI5rvpezElB5U+33RMUU/Kz3pfbgGlPaq/zvF88CJrbNbdft3HP+IZjp1 U8eKiByCtHitvlzvgUcEwI2r4xiURw7YcEEMeoy3MriDxvhZhs+T+oJmfMBYs3YaikrF xc1WHANk9VQ4hfFoRPHuBtWgFArKRlO6AL7NDoRYoMcl/adSNUShpbnOLQzVjtZiNKGa fFnUZQ09Xg6mcLHJvTeO50El9XBZOnusKVnedYYDfLvFigLUZHX65xihep32tbOpy4vr 6Lmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697827517; x=1698432317; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZfFMOnzOWPDFZoMZUine3Kwx2BGR2wcwPk9fcWx+DPA=; b=omRd7YckUX9OB1blKFfc8rnaDIUyXeDz/G7+AYdfyvGBp5VBUgqHOT7sPKZDYPJGZ3 6s3up4/N38MDHZeU63xUxt1ZSRqPaDLd1Kv3qR+K/bOSbFupChU9Cny1MeeV5zsPga+b bZmTHT++9jJV0yPejYtUzmc4vStsPvyLV5l35cCDaIZz7FgsQq5S0k0AG/IBCxoWDXCS PvanioyybiranSUWhYYeUCAac52t+rw/2N03HIYvBi5gbIPq/4JYheZM2Hh8R9psu3Ah 4fUWG7WolYUuSaMiEhOSy60Bs/6Ej0Au1C07shlH7nEbpwogu1fFtWMtgaoWURRPTSMU 10Nw== X-Gm-Message-State: AOJu0YyxE08OQl5wqSi8iIOkFyqaWLZvHqUfYc7vuANwvTAQ1zcl4tcO YKenlGfIk4eUjrSs45MYV4Hkh/cpzs7JY/JmifDRxQ== X-Received: by 2002:ac2:5a0a:0:b0:4fb:9f93:365f with SMTP id q10-20020ac25a0a000000b004fb9f93365fmr1881407lfn.38.1697827516928; Fri, 20 Oct 2023 11:45:16 -0700 (PDT) MIME-Version: 1.0 From: Jan Henrik Weinstock Date: Fri, 20 Oct 2023 20:45:05 +0200 Message-ID: Subject: KVM exit to userspace on WFI To: maz@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, =?UTF-8?Q?Lukas_J=C3=BCnger?= Content-Type: multipart/mixed; boundary="00000000000009855e06082a46e7" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 20 Oct 2023 11:45:32 -0700 (PDT) --00000000000009855e06082a46e7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, I am looking for a way to have KVM_RUN exit back to userspace once the vcpu encounters a WFI. It seems the kvm_run->request_interrupt_window flag is currently ignored by arm64. So my solution thus far is to patch kvm_handle_wfx in arch/arm64/kvm/handle_exit.c and return to userspace with KVM_EXIT_IRQ_WINDOW_OPEN - working example attached. Any chance to get this (or something similar) mainline? --=20 Dr.-Ing. Jan Henrik Weinstock Managing Director MachineWare GmbH | www.machineware.de H=C3=BChnermarkt 19, 52062 Aachen, Germany Amtsgericht Aachen HRB25734 Gesch=C3=A4ftsf=C3=BChrung Lukas J=C3=BCnger Dr.-Ing. Jan Henrik Weinstock --00000000000009855e06082a46e7 Content-Type: text/x-patch; charset="US-ASCII"; name="kvm.patch" Content-Disposition: attachment; filename="kvm.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lnyy9nky0 ZGlmZiAtLWdpdCBhL2FyY2gvYXJtNjQva3ZtL2FybS5jIGIvYXJjaC9hcm02NC9rdm0vYXJtLmMK aW5kZXggNTRkMjZmMTNmLi43YmU0MmUzZjEgMTAwNjQ0Ci0tLSBhL2FyY2gvYXJtNjQva3ZtL2Fy bS5jCisrKyBiL2FyY2gvYXJtNjQva3ZtL2FybS5jCkBAIC0yMTUsNiArMjE1LDcgQEAgaW50IGt2 bV92bV9pb2N0bF9jaGVja19leHRlbnNpb24oc3RydWN0IGt2bSAqa3ZtLCBsb25nIGV4dCkKIAlj YXNlIEtWTV9DQVBfU0VUX0dVRVNUX0RFQlVHOgogCWNhc2UgS1ZNX0NBUF9WQ1BVX0FUVFJJQlVU RVM6CiAJY2FzZSBLVk1fQ0FQX1BUUF9LVk06CisJY2FzZSBLVk1fQ0FQX0FSTV9XRlhfRVhJVDoK IAkJciA9IDE7CiAJCWJyZWFrOwogCWNhc2UgS1ZNX0NBUF9TRVRfR1VFU1RfREVCVUcyOgpkaWZm IC0tZ2l0IGEvYXJjaC9hcm02NC9rdm0vaGFuZGxlX2V4aXQuYyBiL2FyY2gvYXJtNjQva3ZtL2hh bmRsZ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