From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C320DC433EF for ; Thu, 30 Jun 2022 16:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-reply-to:Date:Subject:Cc: To:From:References:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xRwnQX/TABLYLQQJ2mC+Sp+uxa47nQ4fQd/nBDb+hgs=; b=cAtWvxUzxY0AfzGEFshofnhSdA yTRv1Q/evmqRXmLqupSoQ4oKIHZBFgBZhTE0T8EdLtk7Q4qVHsmrTloXELBzh1YAWYhUv8PjkKSB7 Opq4+4IH1srOs+qIOm9sjx9Dxd3cFhOU5I8JgFLqw2xSzh3H9vqGYCSelqd5eItxvzifYtIXnQNOM xxKzHmLbO2fBSAk6bGuTSlC2BRUTyfAR9UyDKwV7ZPXe8vswqRMTue2mzaTSl/EgfNmlHO962mqcG iuWx/IVL4LlZ4daVzI/1FVjvNhCBbHg2+L8eg1Hmxqy+y8zpalV6LY5SlHlVxI2FHUt6GWfnv0ymz RxMbYPmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6xRT-000hD0-GN; Thu, 30 Jun 2022 16:54:59 +0000 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6xRR-000hBP-0Q for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2022 16:54:58 +0000 Received: by mail-io1-xd2a.google.com with SMTP id p128so19739183iof.1 for ; Thu, 30 Jun 2022 09:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=3yzQoY2ucWrQqXREQTyNPjG4X86W8VdDP00R8nZTgn0=; b=gKHIqcp0AXkJmHeV5RhLZd4icY5aYh4HmgWSU7ggoO73jfesxxLYVvV03O8gLsc2g5 +cOwbiWrWLrnxa5Ivba04k23sLZ/VzDqvVJGxIuNRO5EFyAaZT8XPV48zebXLz7r3zPE nRM+1xIjvy9uFrtZkqNlL92HXCv2ysiQc2OBuTiijyC60csdeQWNQUric+SODQoFdcNO +f5AT3XUhy8XYk6g7mLvG0i5OjWUMLHCs5JRBTmY/dYg2Bx0dAaSfEcVomqUN6GSSFmM bFdS0Oweb2Xt6h1Wo2E36OtoM61U2v81mUipbJ64BoAnv3q3w5ZV7NEw6i9ETiEp66jF dXsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=3yzQoY2ucWrQqXREQTyNPjG4X86W8VdDP00R8nZTgn0=; b=1aI0LHS9aafAih7k1dwC88axjSffIP68V+P9OXYgPfq2MsnuNQZjpyMYlue7zptqnn hoD+TfZq/qDftL2n20fRrNAmh1OdpWTIU4JO+V/NP3XFZFi6SNcrgiH8RnmfGZHqPgb1 jgfIOgtJnsQUM2brOpPd2n922ng8AvQOZOG4BZbd3Ryjb4dNFVPlJt8UISK6QJ+lHcsf 4VkBW3ke8YcshLBq6EFfArITrfYoKp8RU/K0deUgLMBXAfQYI0IClgoFYZgAtRzjFtD7 E7roP4QZQjCqjjfmHEdnQ3ryLt2ew8a5y9TEvlpOK6PnYNwcbMge3hClm/g02WX6Lnht G0Ig== X-Gm-Message-State: AJIora8mXfMO4qvEqnC624xYztryYOALqKVT9Mry9TJ1IDjjdSXpzghq oJD/x7oEByxhGwIUfrJha20= X-Google-Smtp-Source: AGRyM1t1lqGrk46YUgq5ZmtKS2YxO4+SXDt+L/ChvS1zfaHjZTfXt/gVL3fenni78YqCtJp7hGr+WQ== X-Received: by 2002:a05:6638:1a8d:b0:33c:9a98:ff2d with SMTP id ce13-20020a0566381a8d00b0033c9a98ff2dmr6243491jab.31.1656608095139; Thu, 30 Jun 2022 09:54:55 -0700 (PDT) Received: from ArchLinux ([240e:390:a20:ece0:3ad5:47ff:feb5:73b2]) by smtp.gmail.com with ESMTPSA id p7-20020a02b007000000b00339dd3976absm8723936jah.110.2022.06.30.09.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 09:54:54 -0700 (PDT) References: <20220630161220.53449-1-schspa@gmail.com> <87mtdu15ok.wl-maz@kernel.org> User-agent: mu4e 1.7.5; emacs 28.1 From: Schspa Shi To: Marc Zyngier Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Fix 64 bit mmio handle Date: Fri, 01 Jul 2022 00:50:59 +0800 In-reply-to: <87mtdu15ok.wl-maz@kernel.org> Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220630_095457_110620_98C46A88 X-CRM114-Status: GOOD ( 20.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Marc Zyngier writes: > On Thu, 30 Jun 2022 17:12:20 +0100, > Schspa Shi wrote: >> >> If the len is 8 bytes, we can't get the correct sign extend for >> be system. > > I'm afraid you'll have to give me a bit more details. > >> >> Fix the mask type len and the comparison of length. >> >> Signed-off-by: Schspa Shi >> --- >> arch/arm64/kvm/mmio.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/arm64/kvm/mmio.c b/arch/arm64/kvm/mmio.c >> index 3dd38a151d2a6..0692f8b18f35c 100644 >> --- a/arch/arm64/kvm/mmio.c >> +++ b/arch/arm64/kvm/mmio.c >> @@ -81,8 +81,8 @@ unsigned long kvm_mmio_read_buf(const void >> *buf, unsigned int len) >> int kvm_handle_mmio_return(struct kvm_vcpu *vcpu) >> { >> unsigned long data; >> + unsigned long mask; >> unsigned int len; >> - int mask; >> >> /* Detect an already handled MMIO return */ >> if (unlikely(!vcpu->mmio_needed)) >> @@ -97,7 +97,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu >> *vcpu) >> data = kvm_mmio_read_buf(run->mmio.data, len); >> >> if (kvm_vcpu_dabt_issext(vcpu) && >> - len < sizeof(unsigned long)) { >> + len <= sizeof(unsigned long)) { > > If you're reading an 8 byte quantity, what is there to > sign-extend? > Sign extension only makes sense if what you're reading is > *smaller* > than the size of the register you are targeting. > Yes, you are correct, sorry for my bad patch. Please ignore this patch. > I must be missing something. And how is that related to running > BE? BE > in the host? The guest? I mean BE is for guest running with BE mode. > > Please convince me. > > M. -- BRs Schspa Shi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel