From patchwork Wed Oct 4 08:43:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 729256 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp230504wrs; Wed, 4 Oct 2023 01:43:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS53jJlml6rxU6jTqcfNhKuXVuggGksv/tLw3ONOjcvsiqdSY4TjCVZ/J1rlbqRvpy1Vks X-Received: by 2002:a05:620a:1253:b0:76d:89c5:78a0 with SMTP id a19-20020a05620a125300b0076d89c578a0mr1491916qkl.63.1696409030507; Wed, 04 Oct 2023 01:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696409030; cv=none; d=google.com; s=arc-20160816; b=IWg7f6+yy0Q1bmF5oPCnUn9zjiwmBsQHHNrRRp3Q2H1yyCE13J9yI18I/vB0tGd7/S FgJ3+4bUN9KJAQl/TU74FqaCpTrlon3iQQfLoNspHH6QvTAx6FT/RyllyLTkCFJdTyzN eOeB2U5EW+RORI0ugjHRfwHURS8LuA1pjajzg15IGsRbMSAXuZ7NKf6S8uXpbuB+571f C7UhZwt6LT0TA6RQRIRnoxKgAe3MK82iYEa3Z09Ze7A8ZfxczXDcB6HHV9Ck5BCZWMzE +x6PwoVt177L22PVpoAiEHwdX2KIs3lEnc7XUOhpLFATB3WOann5V585lJLXjyAY3Io3 LV0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZPz4GnJfkENcst/YvbRzP3MUYaB7CKMx8l9nJBdXF6s=; fh=zhzFgY8F88gmLqhr0Gjm2ulsyPFhXBed6tbGp+K0bf4=; b=VNjcEYCFtmKdVs4BFUFNU2ooJpDWHMH/Bi5kHSANkhvZvyR88YM6QrGPH+yoHRMYUV +i3AO7yO745lqvmbzh0LcjJ11106Eg6Tbbrm9G/lwugI+bhsjTS/5qaL60MiDJRtxLxH moIKvUFL/JZxij4T2lCVA4zDv9SiM1lahkBt6ADJehtrD/TxZcCtn7OwuUr7JkHyFWLl ao1xbiPm4/44INTuf7mXfSNzB/WQNeCPkzgQM3b+k0ZlEeifg25a3XXl42WEVEAZwSr3 FRo6OY4MmZvvuRK7h5d1x2eGi0/IsuVekSgWD++nbw2oo3lNm9Q4dL+DCFB9WN4/UEzQ u8sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RGCKn3Qh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs6-20020a05620a470600b00775a9cd3e75si1261306qkb.479.2023.10.04.01.43.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 01:43:50 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RGCKn3Qh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnxTe-0002BP-C6; Wed, 04 Oct 2023 04:43:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnxTc-00026i-90 for qemu-devel@nongnu.org; Wed, 04 Oct 2023 04:43:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnxTZ-0000tJ-G1 for qemu-devel@nongnu.org; Wed, 04 Oct 2023 04:43:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696409004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZPz4GnJfkENcst/YvbRzP3MUYaB7CKMx8l9nJBdXF6s=; b=RGCKn3Qhq9MnHS2HLhKMIfUBQprb0Z42dv0QO06764zPGGrxtEHFQ4/rZdAN4y5aRm7qNc bUTzTTILzpGyueiIRtwVa69vHVvAcIfqELNeglxek9EoTpTNyRglvh/kSYhsp9UU99L3cT X4mR1VzJn+SMsRT0KmvE1/IWGk3WUh0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-AeRNtOT2PyCWU9xULHPEyA-1; Wed, 04 Oct 2023 04:43:23 -0400 X-MC-Unique: AeRNtOT2PyCWU9xULHPEyA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40554735995so13642665e9.1 for ; Wed, 04 Oct 2023 01:43:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696409001; x=1697013801; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZPz4GnJfkENcst/YvbRzP3MUYaB7CKMx8l9nJBdXF6s=; b=VG8mMO3rmnBpzmGod7m26FnmCJnAaqcOCb+I/2G4hLN4/Sl9iJp1YcbOyWr/3Y5fLI hLqt5lzAdUM9p4Uc3ViY05SnQHYE84+BvqNopg9nfjhtMoj9uM333FCMTj7ZWEZUPc1y yuT/tZxPCJaZZUvZ0AQYWRUF5P3hJTReuaDX3nR5GvlAFU9Cfx1R5RsZvRCw7SrnA5u5 gDZtQmOJRawCANrQitRSHYdPEyWAGfj3QmAoVfg09YoEJ/4JZFwQy2RstcXGlKETgYWF IOXfIn7fah6smuWyBCzFy8tz/FgjrKOD7PgUlfJ1Rq8R4sgrvldBN8dOGRx73q9bHssZ ET9w== X-Gm-Message-State: AOJu0YwAQSRTwS7lgD+dXfLEni6Bn+/1W4icG6eVPwngVzYh+htwj8D4 0Qkp/PUE4mASkiOq/vRjiYw+RKAE35ipeRxN34O4rZ3QCWHr9e0P+EZWCou0rIyZc+Y9YAxyQGi RQXTLbVEAgg12l1/IzBkw2/iD9N9me9rzqYC+xaQBDeRHI0z+RNBL5AcldUCepPt3CFIB X-Received: by 2002:a05:600c:1d9c:b0:406:8494:f684 with SMTP id p28-20020a05600c1d9c00b004068494f684mr951996wms.23.1696409001533; Wed, 04 Oct 2023 01:43:21 -0700 (PDT) X-Received: by 2002:a05:600c:1d9c:b0:406:8494:f684 with SMTP id p28-20020a05600c1d9c00b004068494f684mr951983wms.23.1696409001269; Wed, 04 Oct 2023 01:43:21 -0700 (PDT) Received: from redhat.com ([2.52.137.96]) by smtp.gmail.com with ESMTPSA id r7-20020a5d6c67000000b00327df8fcbd9sm3274619wrz.9.2023.10.04.01.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 01:43:20 -0700 (PDT) Date: Wed, 4 Oct 2023 04:43:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Philippe =?utf-8?q?Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson Subject: [PULL 03/63] hw/virtio: Propagate page_mask to vhost_vdpa_section_end() Message-ID: <7867e42e54e7721ef944e8b767b6b1965096be82.1696408966.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com 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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Propagate TARGET_PAGE_MASK (see the previous commit for rationale). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20230710094931.84402-3-philmd@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 118c588205..3ab0dc0b5b 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -31,11 +31,12 @@ * Return one past the end of the end of section. Be careful with uint64_t * conversions! */ -static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section) +static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section, + int page_mask) { Int128 llend = int128_make64(section->offset_within_address_space); llend = int128_add(llend, section->size); - llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); + llend = int128_and(llend, int128_exts64(page_mask)); return llend; } @@ -69,7 +70,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section, */ if (!memory_region_is_iommu(section->mr)) { - llend = vhost_vdpa_section_end(section); + llend = vhost_vdpa_section_end(section, page_mask); if (int128_gt(llend, int128_make64(iova_max))) { error_report("RAM section out of device range (max=0x%" PRIx64 ", end addr=0x%" PRIx64 ")", @@ -331,7 +332,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - llend = vhost_vdpa_section_end(section); + llend = vhost_vdpa_section_end(section, TARGET_PAGE_MASK); if (int128_ge(int128_make64(iova), llend)) { return; } @@ -415,7 +416,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - llend = vhost_vdpa_section_end(section); + llend = vhost_vdpa_section_end(section, TARGET_PAGE_MASK); trace_vhost_vdpa_listener_region_del(v, iova, int128_get64(int128_sub(llend, int128_one())));