From patchwork Mon Sep 30 07:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 831526 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp1833021wrw; Mon, 30 Sep 2024 01:05:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrxxgrfK9LoRLg5/e1rTOfRrumQp1GC1HBj17TW/MG+4HQ6zznB+peayvn+bqQOETxXFNe2w==@linaro.org X-Google-Smtp-Source: AGHT+IHHKihocnO6Aww9zN0671vfFWVelbXfPyLY1JvwEmpHRCuE96Tthm2wYA/cEkRCZtXI3NVi X-Received: by 2002:a05:620a:414b:b0:7a9:d0d2:a5fd with SMTP id af79cd13be357-7ae378c28f1mr1674636985a.49.1727683507065; Mon, 30 Sep 2024 01:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727683507; cv=none; d=google.com; s=arc-20240605; b=caTz5vejWqeXMU/NoMtNs4DwmKxhcAQOSlevSca9/XvFmchyE3xclv305jQZMaKNIW vtz5whZnhvIRtffYb6WHU32ltWgKG0I/LvQU42KwIg/r+IjJZxvon8e+NXTNIFFD48Ze POVEfX3ZrwKDc9nQijJtg7CJ7kQwIXPujOuqRqLh4ZO/h0BNt1TzO2+eQ5b8jay22DQ3 piPpzV9gVIQbnS2cS9lKAmbcLBwW2dVQKXhmSciRPyLXHQwZcNgTucQu121NvezHGuGg wVgiVjgKTySq9sWo7LEmEPfPMYuTyO3fyeL+M6Sb8pDGa0X6+gE+r6gNCgteGOO4unY1 MTew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=No3UNTdnI2PUra55xn+9Km9SFh7ve86YSqv3e3Ulz3I=; fh=Wy2Q3sNWPDKxNwELUcZZKTFep4jJmSUk04d3iQNw3B8=; b=FmQgVUG6uRYNBpWPahcvAgaT+5IxQ4lr1/9ONc+q+f15yrrIypR4wgn4bkB2Yl4Qgh FOGeMVVNhDkuU77xPcGx8FeNnEQUqp9N3hC0kSGZZSnMI5g+VBQYpbKcBa/z99zTj2xw tRv7tjL0PGoY3LYOCOqI4kJ6ufJ0Nq+aPsxyI305/aqe8ZOutjBNFF5Idb0a+eil4PO8 6nqJBFbU8YT4ikoqN1Vdm7QVjtCA17pFDba0w7WSrMtY8VIaWBY+hHiWcIWBL5mG9ljn 8WC+BZmn7xE5+SPkeTiuzvaNiItQk5YKb1yqrIqUYyHMcLvvl7Xb798tS4pqfcIrCH2A 9m4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cGPdYwHR; 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=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae3783899dsi802295685a.313.2024.09.30.01.05.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Sep 2024 01:05:07 -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=@linaro.org header.s=google header.b=cGPdYwHR; 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=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svBOj-0001dA-US; Mon, 30 Sep 2024 04:04:49 -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 1svBOi-0001XZ-A1 for qemu-devel@nongnu.org; Mon, 30 Sep 2024 04:04:48 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svBOg-00044R-Gc for qemu-devel@nongnu.org; Mon, 30 Sep 2024 04:04:48 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fad15b3eeeso3659651fa.2 for ; Mon, 30 Sep 2024 01:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727683484; x=1728288284; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=No3UNTdnI2PUra55xn+9Km9SFh7ve86YSqv3e3Ulz3I=; b=cGPdYwHRMNimol0TN8CzfspVViAIYwiGSabVLXFxGnD4btuGQQGohQukOcNkjmgvQQ 253CwH0aWgoBikt8ApJaW9zFH8rg8nbtll7ESjOxUP0+9LaUk0kYueitgCjj0b4GJDQ5 i9VFJLOgUtwl8EbeVwildaI1RHgWiiP0dm9cZoO9hkmvOIZ2uisbz6aD6gpuN0sYVMqy 0BtMsdAwQE6AWIju+0fR4RKdaFud1FnmYzdwiXkwGOqvxTgpkDGM5p6YEDG2beDW89Eu Xc82v9Q14d/aBC3pRmKHUF0VCviJuUSIpBKx11isqElYoaJLQGtfJW4iRZa+UgFCiXLM IxfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727683484; x=1728288284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=No3UNTdnI2PUra55xn+9Km9SFh7ve86YSqv3e3Ulz3I=; b=hYk5IAzsllT3SPsrocYSWb8gmQxV90G7Ie0+OZ1fhcSCdK0v4EBLpArZrBFl4xmbMK Lr1BJ43ZJ2Ylel5zqmV90dzlGIcXMyXmuBwEJ/3QgRfOWBzEg2n7dOHw6d01k6nc7pJi 9RsT7nNAI8RRKCRS9TFVYs2a/mRTjmDON03gj0BvZa5if0VopQBSjRDhPPlBaDQaB9JW M5uyr1Y+joAMpnIpw6B+xGzFynaUiXDMGEo+NBZn5XUNnJNOYVXxS+9yBAP8HIWJ5Aww Ysvo67ay7m3BQrU+IpyDpK3jvXmU9saGppWxX/FDc6TnV5YBDXegrJN4cTFX6S+PcXJE 9qxA== X-Gm-Message-State: AOJu0YzezijOssdQiF3TVwCONsPWX4oue2ap5ZioFqOlsRuokz0OJusr SAzT1WmEC5uTFCQTifKMA4/sEyIZILLHbXX+hrYZHC9obl5VhZX3nOxWtGtQpXx+nRuQHWXicFi wWlc= X-Received: by 2002:a05:600c:4f01:b0:42c:afea:2a10 with SMTP id 5b1f17b1804b1-42f58441814mr91713325e9.21.1727681778254; Mon, 30 Sep 2024 00:36:18 -0700 (PDT) Received: from localhost.localdomain (186.red-88-28-13.dynamicip.rima-tde.net. [88.28.13.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e96a54dd4sm141894255e9.45.2024.09.30.00.36.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 00:36:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mahmoud Mandour , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Alexandre Iooss , Jason Wang , Aleksandar Rikalo , Anton Johansson , Peter Maydell , Huacai Chen , "Michael S. Tsirkin" , Sven Schnelle , Jiaxun Yang , qemu-arm@nongnu.org, Aurelien Jarno , Pierrick Bouvier , Max Filippov , Paul Burton Subject: [PATCH 10/13] hw/virtio/virtio-access: Use ld/st_endian_phys() API Date: Mon, 30 Sep 2024 09:34:47 +0200 Message-ID: <20240930073450.33195-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930073450.33195-1-philmd@linaro.org> References: <20240930073450.33195-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 Refactor to use the recently introduced ld/st_endian_phys() API. No logical change intended. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- include/hw/virtio/virtio-access.h | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index b920874be8..37a42407ea 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -43,30 +43,21 @@ static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa) { AddressSpace *dma_as = vdev->dma_as; - if (virtio_access_is_big_endian(vdev)) { - return lduw_be_phys(dma_as, pa); - } - return lduw_le_phys(dma_as, pa); + return lduw_endian_phys(virtio_access_is_big_endian(vdev), dma_as, pa); } static inline uint32_t virtio_ldl_phys(VirtIODevice *vdev, hwaddr pa) { AddressSpace *dma_as = vdev->dma_as; - if (virtio_access_is_big_endian(vdev)) { - return ldl_be_phys(dma_as, pa); - } - return ldl_le_phys(dma_as, pa); + return ldl_endian_phys(virtio_access_is_big_endian(vdev), dma_as, pa); } static inline uint64_t virtio_ldq_phys(VirtIODevice *vdev, hwaddr pa) { AddressSpace *dma_as = vdev->dma_as; - if (virtio_access_is_big_endian(vdev)) { - return ldq_be_phys(dma_as, pa); - } - return ldq_le_phys(dma_as, pa); + return ldq_endian_phys(virtio_access_is_big_endian(vdev), dma_as, pa); } static inline void virtio_stw_phys(VirtIODevice *vdev, hwaddr pa, @@ -74,11 +65,7 @@ static inline void virtio_stw_phys(VirtIODevice *vdev, hwaddr pa, { AddressSpace *dma_as = vdev->dma_as; - if (virtio_access_is_big_endian(vdev)) { - stw_be_phys(dma_as, pa, value); - } else { - stw_le_phys(dma_as, pa, value); - } + stw_endian_phys(virtio_access_is_big_endian(vdev), dma_as, pa, value); } static inline void virtio_stl_phys(VirtIODevice *vdev, hwaddr pa, @@ -86,11 +73,7 @@ static inline void virtio_stl_phys(VirtIODevice *vdev, hwaddr pa, { AddressSpace *dma_as = vdev->dma_as; - if (virtio_access_is_big_endian(vdev)) { - stl_be_phys(dma_as, pa, value); - } else { - stl_le_phys(dma_as, pa, value); - } + stl_endian_phys(virtio_access_is_big_endian(vdev), dma_as, pa, value); } static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v)