From nobody Fri May 17 06:43:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105848+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105848+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1686121254; cv=none; d=zohomail.com; s=zohoarc; b=XJFVB/60bJtDIwGYZJX+h7WLcoFb/E41mEfHPHCkd4xZ67qz0g5rZ852PStapCPnw1Y6OODRyBder+d1o248yD4pwgmkRBe5Euakt4a/IdaxTr2cDQqEe0saVhIPJ2Mtsb/ABQX6LDKD16kvX5Xu8uKiFyff+Sgo0KbIQzZvDvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686121254; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=1TZlcUBRO2QLISxa6UF3UV5Yrif+OezwX0ie2ycMvAE=; b=InlGqFxacsTplK2OffSplIMWvmrsjmJe225vMlUNe6AXLPfb60s2KwYkvHYMF10o/cA/U+NG1+YSXsLyyba5LbU0nD5ihX0DXF9m9ODTLJFcSWtws5dP2FjE+zPjcF9wehw1ARwZtQFHRf0CmYqmdjTCULvL4qOhqAlGKB7CWZ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105848+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686121254005867.913885762949; Wed, 7 Jun 2023 00:00:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rSk6YY1788612xmLJ0Ud3UuN; Wed, 07 Jun 2023 00:00:53 -0700 X-Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mx.groups.io with SMTP id smtpd.web11.2712.1686121252819009549 for ; Wed, 07 Jun 2023 00:00:52 -0700 X-Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-53f9a376f3eso6283214a12.0 for ; Wed, 07 Jun 2023 00:00:52 -0700 (PDT) X-Gm-Message-State: TTMJiX1LA18o09PsizaZCYVPx1787277AA= X-Google-Smtp-Source: ACHHUZ7VxHGOk1JD1xeDXQQ/176kV/lhPpW8CMAOvvSYJcDyzR989Wb6L95CrWKDQic2mt/e5MlUCg== X-Received: by 2002:a17:90a:ac10:b0:24e:4b1c:74d2 with SMTP id o16-20020a17090aac1000b0024e4b1c74d2mr4577558pjq.32.1686121251308; Wed, 07 Jun 2023 00:00:51 -0700 (PDT) X-Received: from localhost.localdomain (c-174-50-177-95.hsd1.ca.comcast.net. [174.50.177.95]) by smtp.gmail.com with ESMTPSA id j22-20020a17090a7e9600b00259b729eea9sm661627pjl.8.2023.06.07.00.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 00:00:50 -0700 (PDT) From: "Tuan Phan" To: devel@edk2.groups.io Cc: andrei.warkentin@intel.com, sunilvl@ventanamicro.com, Tuan Phan Subject: [edk2-devel] [PATCH] OvmfPkg: RiscVVirt: Fix wrong checking Pci IO access Date: Tue, 6 Jun 2023 23:08:29 -0700 Message-Id: <20230607060829.4442-1-tphan@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,tphan@ventanamicro.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686121253; bh=P4k3dYkCC2b3LcCTFpAhCv52avOGJfYnw2NA4MvfYKY=; h=Cc:Date:From:Reply-To:Subject:To; b=NGxNlE1frlYzrj7sFhAP7K8uPYTVHI9oYjlxGsER6RbsXmvyWruX8SWnJTsM4ZiY+jH c6o8XBvcQtOmM6RB6kkjd3IELeln74PD8USwjxgKPG9v94IcqAmcyOR7QH3DuJplQ1HJP jqV0D7lyflDas7RMNVpQfXB94nHmfqgkXhw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686121255429100001 Content-Type: text/plain; charset="utf-8" RiscV uses memory access for IO and MMIO resources, the address limit is MAX_ADDRESS for both of them. Signed-off-by: Tuan Phan --- OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c b/OvmfPkg/RiscVV= irt/PciCpuIo2Dxe/PciCpuIo2Dxe.c index f3bf07e63141..75389235d897 100644 --- a/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c +++ b/OvmfPkg/RiscVVirt/PciCpuIo2Dxe/PciCpuIo2Dxe.c @@ -19,8 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include =20 -#define MAX_IO_PORT_ADDRESS 0xFFFF - // // Handle for the CPU I/O 2 Protocol // @@ -143,16 +141,16 @@ CpuIoCheckParameter ( // Address + Size * Count. If the following condition is met, then the = transfer // is not supported. // - // Address + Size * Count > (MmioOperation ? MAX_ADDRESS : MAX_IO_POR= T_ADDRESS) + 1 + // Address + Size * Count > MAX_ADDRESS + 1 // // Since MAX_ADDRESS can be the maximum integer value supported by the C= PU and Count // can also be the maximum integer value supported by the CPU, this range // check must be adjusted to avoid all overflow conditions. // // The following form of the range check is equivalent but assumes that - // MAX_ADDRESS and MAX_IO_PORT_ADDRESS are of the form (2^n - 1). + // MAX_ADDRESS is of the form (2^n - 1). // - Limit =3D (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS); + Limit =3D MAX_ADDRESS; if (Count =3D=3D 0) { if (Address > Limit) { return EFI_UNSUPPORTED; --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105848): https://edk2.groups.io/g/devel/message/105848 Mute This Topic: https://groups.io/mt/99379856/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-