From nobody Fri Dec 19 18:42:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601573198; cv=none; d=zohomail.com; s=zohoarc; b=eXZJjUeZhvgrOE01kIACJvMiS8DejTAgrbRP2VrEm2AvBKMZj1NNz/8eP3fCdUGsxlv6wlP/Vn+T67k0shEyKU6FN92q84qIu7EC39QmcTnlBYxoDkwW1mXyxBpQKEMrXynspBZRoDlyig63Y1pyXti0sCKRpz/SfJZqLTQK1sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=LheIxsxewDybPFwsOvkh7rukKgOfXZf7NWIRrXpFvUwHQucz36Y4jxr8uJa/5SE/v97/lOg8Cb2OeSkPtjwIQqYIkRepZuOxGHRo90TzpF8TQxe1MZ7aP35aOlPqKP0laXSX2aTIymnVaQ6ZF2Jvf2y60DForQNsDcj56weJiwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573198819407.6402513026627; Thu, 1 Oct 2020 10:26:38 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-kGbnGb-CMWa3TUmjUmMgrw-1; Thu, 01 Oct 2020 13:26:35 -0400 Received: by mail-wm1-f69.google.com with SMTP id 73so1414137wma.5 for ; Thu, 01 Oct 2020 10:26:35 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id 91sm10566746wrq.9.2020.10.01.10.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573197; 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=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=EQkKIZW9t+rt7Z7iY5h5Ekw9tBDcrcYxV4GqlS36Qy3QaqB75RxW0EFiMGgyIAzBp+pNXD XiQBVJrknq58qiPtzbg26uUTuGJH6dfvQ9R1rsXt04Vs42+V7cG+fojgzM7D/W9zkzsI9A LwWrqRfPYPESAe1ZkgKrT95DGtsvUAU= X-MC-Unique: kGbnGb-CMWa3TUmjUmMgrw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=QIslIJvsV0lO4lrVZKnGSVxRn+S385FmMTB3Ws9rA/wNvdoxQqYRZgYR9tb/f1VKPn gDCnDS2d5ULppvrJREpBl5fdg1SiF9Tacb+r4XmREsO5RBFTTxp84P5YiAqeLlDKXoLY l9O5F1NgV8+x8rvkyQNOddWGUmxIdVR/iKZk/heUiDe2uRtww2nmJdtg93vDtgCYWZHJ 2V9NapBLsyfK0VkDiaWmUwJnduDrqBuJdNBbkv/kKJpcQLLrKaqoIeX1KHggxFfjPttr ky9iUFor2n2C5EGFLKAR1lmK8COSjKbZSZvZ8FhjThrN7yah/Psm/gdoFLCZ7Oc2slwS Xmnw== X-Gm-Message-State: AOAM530DmOijSWHFTPQFgJK68CICIa20iLQf5DJNUZMXxgdMrcKtHoW5 xEiskrOoIFQlh25W7nUBP5/K7Y2q4/BnHNGqKyOY3eKu3BpyFqHlM0YYVSD5Z0pNO038UoaHaek 0TNt/ehz9pPWwIQ== X-Received: by 2002:a5d:444b:: with SMTP id x11mr10198219wrr.402.1601573194746; Thu, 01 Oct 2020 10:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8qPOM1Udi/2cBugLloC9divrpOXmVTglaNEW/vT5l+SfLuO6e76tELiU7VXg3D4iewNv2Lw== X-Received: by 2002:a5d:444b:: with SMTP id x11mr10198199wrr.402.1601573194566; Thu, 01 Oct 2020 10:26:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 15/16] pci: Let pci_dma_read() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:18 +0200 Message-Id: <20201001172519.1620782-16-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172519.1620782-1-philmd@redhat.com> References: <20201001172519.1620782-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) pci_dma_rw() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Li Qiang Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index f77f4e49e4..299df068c9 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -801,8 +801,20 @@ static inline MemTxResult pci_dma_rw(PCIDevice *dev, d= ma_addr_t addr, dir, MEMTXATTRS_UNSPECIFIED); } =20 -static inline int pci_dma_read(PCIDevice *dev, dma_addr_t addr, - void *buf, dma_addr_t len) +/** + * pci_dma_read: Read from an address space from PCI device. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). Called within RCU critical section. + * + * @dev: #PCIDevice doing the memory access + * @addr: address within the #PCIDevice address space + * @buf: buffer with the data transferred + * @len: length of the data transferred + */ +static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr, + void *buf, dma_addr_t len) { return pci_dma_rw(dev, addr, buf, len, DMA_DIRECTION_TO_DEVICE); } --=20 2.26.2