From patchwork Tue Aug 11 11:41:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709131 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A578614E3 for ; Tue, 11 Aug 2020 11:46:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B6AC2075D for ; Tue, 11 Aug 2020 11:46:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KcxgS2ZB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B6AC2075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5SjO-0004Tm-MQ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5ShO-00011i-OY for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:10 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:41817 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5ShM-0008H1-VN for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146248; 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=O3rQyYFC2scFIz/XUUni2PfV2OOrFxGCh7tG7NMzdYM=; b=KcxgS2ZBnAVfrFryvSWF8bG69j0Yv3usWet1HAJn4PGjDzqwMEvqJgyQOHsteGJKE42AHP rZ9Fc0Rhmsr227hZrMmK0gK2C0PZu9jOQiJWb+jpeLWL71FosGL8Qr78xDlfDGb3kLVICD nk1MezzrsJryxSO7DZRfpcjcT3ouuRQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-zw6DeT4zMQCO7K0OBtWUuA-1; Tue, 11 Aug 2020 07:44:05 -0400 X-MC-Unique: zw6DeT4zMQCO7K0OBtWUuA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82121800050; Tue, 11 Aug 2020 11:44:03 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 361AD1C4; Tue, 11 Aug 2020 11:43:55 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 2/9] pci-host: designware: add pcie-msi read method Date: Tue, 11 Aug 2020 17:11:26 +0530 Message-Id: <20200811114133.672647-3-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 04:41:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add pcie-msi mmio read method to avoid NULL pointer dereference issue. Reported-by: Lei Sun Reviewed-by: Li Qiang Reviewed-by: Peter Maydell Signed-off-by: Prasad J Pandit --- hw/pci-host/designware.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) Update v4: add explanatory comment and Reviewed-by tag -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05315.html diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index 8492c18991..db036aac71 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" +#include "qemu/log.h" #include "hw/pci/msi.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" @@ -63,6 +64,23 @@ designware_pcie_root_to_host(DesignwarePCIERoot *root) return DESIGNWARE_PCIE_HOST(bus->parent); } +static uint64_t designware_pcie_root_msi_read(void *opaque, hwaddr addr, + unsigned size) +{ + /* + * Attempts to read from the MSI address are undefined in + * the PCI specifications. For this hardware, the datasheet + * specifies that a read from the magic address is simply not + * intercepted by the MSI controller, and will go out to the + * AHB/AXI bus like any other PCI-device-initiated DMA read. + * This is not trivial to implement in QEMU, so since + * well-behaved guests won't ever ask a PCI device to DMA from + * this address we just log the missing functionality. + */ + qemu_log_mask(LOG_UNIMP, "%s not implemented\n", __func__); + return 0; +} + static void designware_pcie_root_msi_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { @@ -77,6 +95,7 @@ static void designware_pcie_root_msi_write(void *opaque, hwaddr addr, } static const MemoryRegionOps designware_pci_host_msi_ops = { + .read = designware_pcie_root_msi_read, .write = designware_pcie_root_msi_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { From patchwork Tue Aug 11 11:41:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2AB3618 for ; Tue, 11 Aug 2020 11:46:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 889382075D for ; Tue, 11 Aug 2020 11:46:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="e/FuJch4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 889382075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5SjP-0004W8-PR for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5ShU-00018a-C0 for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:16 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:23761 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5ShS-0008HM-5w for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146253; 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=pYlLE+MdAHESmMVPXyDK7PELSpG6MXxzOopxi/3UWEg=; b=e/FuJch44bk3LhwLS4VlLonyzXLrQGbXqLe2tPXmZYc/SEj0gQdQ0ba21N/5+zWDQtzbfd Sqok2m5ka3IZCJUdRH8chEFUcxNPmpxrQrrjQYnFHroQq5W3llbYU1gj7XUN177m9TZkLv KIyFItabmPxx5/0ghifujKs/G2YidLo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-ge-BuHACPaS3FNcSHB8cjA-1; Tue, 11 Aug 2020 07:44:10 -0400 X-MC-Unique: ge-BuHACPaS3FNcSHB8cjA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28A9B8017FB; Tue, 11 Aug 2020 11:44:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 236A55FC01; Tue, 11 Aug 2020 11:44:03 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 3/9] vfio: add quirk device write method Date: Tue, 11 Aug 2020 17:11:27 +0530 Message-Id: <20200811114133.672647-4-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 04:41:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add vfio quirk device mmio write method to avoid NULL pointer dereference issue. Reported-by: Lei Sun Reviewed-by: Li Qiang Reviewed-by: Peter Maydell Acked-by: Alex Williamson Signed-off-by: Prasad J Pandit --- hw/vfio/pci-quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+) Update v4: log guest_error and add Reviewed-by tag -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05326.html diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 3a14b7c303..9b162cc3f9 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -14,6 +14,7 @@ #include "config-devices.h" #include "exec/memop.h" #include "qemu/units.h" +#include "qemu/log.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -264,8 +265,15 @@ static uint64_t vfio_ati_3c3_quirk_read(void *opaque, return data; } +static void vfio_ati_3c3_quirk_write(void *opaque, hwaddr addr, + uint64_t data, unsigned size) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid access\n", __func__); +} + static const MemoryRegionOps vfio_ati_3c3_quirk = { .read = vfio_ati_3c3_quirk_read, + .write = vfio_ati_3c3_quirk_write, .endianness = DEVICE_LITTLE_ENDIAN, }; From patchwork Tue Aug 11 11:41:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709125 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D1D31392 for ; Tue, 11 Aug 2020 11:45:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 041D120768 for ; Tue, 11 Aug 2020 11:45:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GYvGm6nX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 041D120768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5SiC-0002aS-8z for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:45:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Shb-0001Iy-A2 for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49822 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5ShZ-0008J3-KF for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146260; 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=O09w58vU600Gb/fgnR/CT6U8ZBX9brZK7maBJW9LFCA=; b=GYvGm6nXpUaYnM6NoAS9+TQjwHLkdHC0l/CmeXEoE2exofIDRWexNcD6PqwBEO6iF+FS2M NpDCExAYREFv06yFJVpJJqxxD/YhwOXIj8SrsOBzA6+An0ZbE4AC9pKt5HJIy6cznGG2E/ +BhLx7rhyD5XAioHVuAwfXWGmvyq2wk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-Vx89aPbXPruKR59sMB_oVQ-1; Tue, 11 Aug 2020 07:44:17 -0400 X-MC-Unique: Vx89aPbXPruKR59sMB_oVQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 174971083; Tue, 11 Aug 2020 11:44:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCF6C5F9DF; Tue, 11 Aug 2020 11:44:09 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 4/9] prep: add ppc-parity write method Date: Tue, 11 Aug 2020 17:11:28 +0530 Message-Id: <20200811114133.672647-5-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ppandit@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 02:18:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add ppc-parity mmio write method to avoid NULL pointer dereference issue. Reported-by: Lei Sun Acked-by: David Gibson Signed-off-by: Prasad J Pandit Reviewed-by: Li Qiang --- hw/ppc/prep_systemio.c | 8 ++++++++ 1 file changed, 8 insertions(+) Update v4: No change, v3 was acked -> https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg09965.html diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index bbc51b6e9a..e583222a1b 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -235,8 +236,15 @@ static uint64_t ppc_parity_error_readl(void *opaque, hwaddr addr, return val; } +static void ppc_parity_error_writel(void *opaque, hwaddr addr, + uint64_t data, unsigned size) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid access\n", __func__); +} + static const MemoryRegionOps ppc_parity_error_ops = { .read = ppc_parity_error_readl, + .write = ppc_parity_error_writel, .valid = { .min_access_size = 4, .max_access_size = 4, From patchwork Tue Aug 11 11:41:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7937114E3 for ; Tue, 11 Aug 2020 11:48:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BCA52075D for ; Tue, 11 Aug 2020 11:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P2b7zlnC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BCA52075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5Sl5-00075m-EO for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:47:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Shk-0001cx-VV for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:32 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24411 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5Shj-0008Jl-7q for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146270; 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=eKki41DYt9nTQoYvIlZc35X3B/aFJttnQIh3V+LVOus=; b=P2b7zlnCpF8/cEkyqTq7sJDpz8UL/bsL7BpIUbApy/uJLLPUg0iR8ltxT08wg2rRnkfOCb Yd1b3JiLfATZ2Dle124lCr/zfzbqEclouNbJqyY1z0PylCoEXByDsWejpRc4Bo4cvR9tR+ pCsHDBbaoAD93cX+8aH6gltYADgDMbs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-SMJQo0VbOkKV1YUBZFTUGw-1; Tue, 11 Aug 2020 07:44:26 -0400 X-MC-Unique: SMJQo0VbOkKV1YUBZFTUGw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A2C2108E; Tue, 11 Aug 2020 11:44:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB1931C4; Tue, 11 Aug 2020 11:44:16 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 5/9] nvram: add nrf51_soc flash read method Date: Tue, 11 Aug 2020 17:11:29 +0530 Message-Id: <20200811114133.672647-6-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 06:40:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add nrf51_soc mmio read method to avoid NULL pointer dereference issue. Reported-by: Lei Sun Reviewed-by: Peter Maydell Signed-off-by: Prasad J Pandit Reviewed-by: Li Qiang --- hw/nvram/nrf51_nvm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Update v4: add explanatory comment and Reviewed-by tag -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05309.html diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c index f2283c1a8d..7b3460d52d 100644 --- a/hw/nvram/nrf51_nvm.c +++ b/hw/nvram/nrf51_nvm.c @@ -273,6 +273,15 @@ static const MemoryRegionOps io_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static uint64_t flash_read(void *opaque, hwaddr offset, unsigned size) +{ + /* + * This is a rom_device MemoryRegion which is always in + * romd_mode (we never put it in MMIO mode), so reads always + * go directly to RAM and never come here. + */ + g_assert_not_reached(); +} static void flash_write(void *opaque, hwaddr offset, uint64_t value, unsigned int size) @@ -300,6 +309,7 @@ static void flash_write(void *opaque, hwaddr offset, uint64_t value, static const MemoryRegionOps flash_ops = { + .read = flash_read, .write = flash_write, .valid.min_access_size = 4, .valid.max_access_size = 4, From patchwork Tue Aug 11 11:41:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709139 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB9B1618 for ; Tue, 11 Aug 2020 11:46:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B00ED2075D for ; Tue, 11 Aug 2020 11:46:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eFFU9F4I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B00ED2075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5Sjq-0005EW-UI for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:46:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Shu-0001xg-9n for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5Shs-0008LN-1d for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146278; 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=M3JXqjqJElyj06Lz4rtmP2PcYwdH0tRMQK+IE13ukd0=; b=eFFU9F4Is9JykixpTuy3cE5kZjpHNcWrgTIrtsQu3MzMWV482DIwVpFuZU3o4yll+NSrbl 6Nlkj+iTzpjVzggdAAC2LnvDYJHtjnBnaSkXTf2bxuvGkdjnIF9W1SYCSYGFDf8Zq9izeZ k5HdWFtiuTt40SeXVlHq6ZIBhmQI/Rs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-XKnVjypPNCyrciG6Jq9KGQ-1; Tue, 11 Aug 2020 07:44:33 -0400 X-MC-Unique: XKnVjypPNCyrciG6Jq9KGQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94819100CCC1; Tue, 11 Aug 2020 11:44:32 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF2525FC2F; Tue, 11 Aug 2020 11:44:25 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 6/9] spapr_pci: add spapr msi read method Date: Tue, 11 Aug 2020 17:11:30 +0530 Message-Id: <20200811114133.672647-7-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 05:47:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add spapr msi mmio read method to avoid NULL pointer dereference issue. Reported-by: Lei Sun Acked-by: David Gibson Reviewed-by: Li Qiang Signed-off-by: Prasad J Pandit --- hw/ppc/spapr_pci.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) Update v4: fix multi-line comment and log guest_error -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05311.html diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 363cdb3f7b..53dfd3d8c6 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -52,6 +52,7 @@ #include "sysemu/kvm.h" #include "sysemu/hostmem.h" #include "sysemu/numa.h" +#include "qemu/log.h" /* Copied from the kernel arch/powerpc/platforms/pseries/msi.c */ #define RTAS_QUERY_FN 0 @@ -738,6 +739,12 @@ static PCIINTxRoute spapr_route_intx_pin_to_irq(void *opaque, int pin) return route; } +static uint64_t spapr_msi_read(void *opaque, hwaddr addr, unsigned size) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid access\n", __func__); + return 0; +} + /* * MSI/MSIX memory region implementation. * The handler handles both MSI and MSIX. @@ -755,8 +762,11 @@ static void spapr_msi_write(void *opaque, hwaddr addr, } static const MemoryRegionOps spapr_msi_ops = { - /* There is no .read as the read result is undefined by PCI spec */ - .read = NULL, + /* + * .read result is undefined by PCI spec. + * define .read method to avoid assert failure in memory_region_init_io + */ + .read = spapr_msi_read, .write = spapr_msi_write, .endianness = DEVICE_LITTLE_ENDIAN }; From patchwork Tue Aug 11 11:41:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BBEC618 for ; Tue, 11 Aug 2020 11:49:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1211D2075D for ; Tue, 11 Aug 2020 11:49:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cFxWb7rL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1211D2075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:32978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5SmU-0000VB-BJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:49:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Shy-00027Q-Fx for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:46 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:28434 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5Shw-0008Lp-M5 for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146283; 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=w+40PRmSG+ie3kIVNK984GsCnZNEYARZaSwfaWAALM4=; b=cFxWb7rLnIEtcGzh1HAt/d/vsvxU4FVJ97cZBjfDBgnBUfF/SYAH/cKJ68FCx8V4Fc0we7 9sBwhZXHotGCJ/bXNyTUUOQ6DuVteB4F5rbLmTkCL7TGt0UpW7NHuljebFQOH+AFeUvmlx jxtV61ARMnPswamOeD+nGzf3/fhBn2A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-np2jQmmYOmCKKacUNOl_NA-1; Tue, 11 Aug 2020 07:44:40 -0400 X-MC-Unique: np2jQmmYOmCKKacUNOl_NA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7C3E800465; Tue, 11 Aug 2020 11:44:38 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 634135F9DB; Tue, 11 Aug 2020 11:44:32 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 7/9] tz-ppc: add dummy read/write methods Date: Tue, 11 Aug 2020 17:11:31 +0530 Message-Id: <20200811114133.672647-8-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 06:40:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add tz-ppc-dummy mmio read/write methods to avoid assert failure during initialisation. Reviewed-by: Peter Maydell Signed-off-by: Prasad J Pandit Reviewed-by: Li Qiang --- hw/misc/tz-ppc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Update v4: add Reviewed-by tag -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05303.html diff --git a/hw/misc/tz-ppc.c b/hw/misc/tz-ppc.c index 6431257b52..36495c68e7 100644 --- a/hw/misc/tz-ppc.c +++ b/hw/misc/tz-ppc.c @@ -196,7 +196,21 @@ static bool tz_ppc_dummy_accepts(void *opaque, hwaddr addr, g_assert_not_reached(); } +static uint64_t tz_ppc_dummy_read(void *opaque, hwaddr addr, unsigned size) +{ + g_assert_not_reached(); +} + +static void tz_ppc_dummy_write(void *opaque, hwaddr addr, + uint64_t data, unsigned size) +{ + g_assert_not_reached(); +} + static const MemoryRegionOps tz_ppc_dummy_ops = { + /* define r/w methods to avoid assert failure in memory_region_init_io */ + .read = tz_ppc_dummy_read, + .write = tz_ppc_dummy_write, .valid.accepts = tz_ppc_dummy_accepts, }; From patchwork Tue Aug 11 11:41:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709141 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26EC514E3 for ; Tue, 11 Aug 2020 11:47:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF0722075D for ; Tue, 11 Aug 2020 11:47:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D0jiYHrZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF0722075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5Sl4-000730-4Z for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:47:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Si6-0002QR-TG for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:54 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:24203 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5Si5-0008Mz-3g for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:44:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146292; 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=3Q/BqAs8Ts/eEbXJp0DLogWA+BFVDGoTcxFQL7SmVrI=; b=D0jiYHrZlgpEciVGgS0JBqK9cbLZHzwB0yyCBHy78n81ZzeQ35nQQw5Q+IqgLch2rheP7j d+c8OOLuIPX+L77L5pm7s2/IdAvZB/2+366IgJi3GdeifBF1EHr0j4XR517JY+X9tvM4VE BnNYyWybPCkrSOcgRYvXTkKFRdLOTj0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-YsgpB3hHNGK5QTAxFHZybw-1; Tue, 11 Aug 2020 07:44:49 -0400 X-MC-Unique: YsgpB3hHNGK5QTAxFHZybw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D428C1083; Tue, 11 Aug 2020 11:44:47 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6899A5FC01; Tue, 11 Aug 2020 11:44:39 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 8/9] imx7-ccm: add digprog mmio write method Date: Tue, 11 Aug 2020 17:11:32 +0530 Message-Id: <20200811114133.672647-9-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 04:41:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Add digprog mmio write method to avoid assert failure during initialisation. Reviewed-by: Li Qiang Signed-off-by: Prasad J Pandit --- hw/misc/imx7_ccm.c | 8 ++++++++ 1 file changed, 8 insertions(+) Update v4: revise log message to guest_error -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05306.html diff --git a/hw/misc/imx7_ccm.c b/hw/misc/imx7_ccm.c index 02fc1ae8d0..075159e497 100644 --- a/hw/misc/imx7_ccm.c +++ b/hw/misc/imx7_ccm.c @@ -131,8 +131,16 @@ static const struct MemoryRegionOps imx7_set_clr_tog_ops = { }, }; +static void imx7_digprog_write(void *opaque, hwaddr addr, + uint64_t data, unsigned size) +{ + qemu_log_mask(LOG_GUEST_ERROR, + "Guest write to read-only ANALOG_DIGPROG register\n"); +} + static const struct MemoryRegionOps imx7_digprog_ops = { .read = imx7_set_clr_tog_read, + .write = imx7_digprog_write, .endianness = DEVICE_NATIVE_ENDIAN, .impl = { .min_access_size = 4, From patchwork Tue Aug 11 11:41:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 11709145 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20093618 for ; Tue, 11 Aug 2020 11:49:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E83CD2075D for ; Tue, 11 Aug 2020 11:49:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f9CoLIEt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E83CD2075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:32840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5SmS-0000Rn-8O for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Aug 2020 07:49:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5SiC-0002cG-Ah for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:45:00 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:43092 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5SiA-0008O7-Hh for qemu-devel@nongnu.org; Tue, 11 Aug 2020 07:45:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597146297; 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=URgG/GQpF3hxWKP3cotTkm5KWSX2MRj+zKuw0yApTls=; b=f9CoLIEtf+tQvtVGsF5ytGuLZOGhV1jGKjKizRsNBXjNxb4A6ze9g2XwWi7yHSJL1+tXIf epXKBTSlycw4cpMri1LY0+m7amgdgj7j+g0ktKMIpXPUNfjNHny1jsVzph/ghIIfZNzB9P JP7O2czD8/7Vsj5u3QDGYySpoc/MoNA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-IDx7D9ygN06mMvLOfUanVA-1; Tue, 11 Aug 2020 07:44:54 -0400 X-MC-Unique: IDx7D9ygN06mMvLOfUanVA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6005D1005510; Tue, 11 Aug 2020 11:44:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.74.8.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88CCE5FC01; Tue, 11 Aug 2020 11:44:48 +0000 (UTC) From: P J P To: Peter Maydell , Paolo Bonzini Subject: [PATCH v4 9/9] memory: assert MemoryRegionOps callbacks are defined Date: Tue, 11 Aug 2020 17:11:33 +0530 Message-Id: <20200811114133.672647-10-ppandit@redhat.com> In-Reply-To: <20200811114133.672647-1-ppandit@redhat.com> References: <20200811114133.672647-1-ppandit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ppandit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ppandit@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 04:41:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasad J Pandit , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Li Qiang , QEMU Developers , Lei Sun , Alex Williamson , =?utf-8?q?Alex_Benn=C3=A9e?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit When registering a MemoryRegionOps object, assert that its read/write callback methods are defined. This avoids potential guest crash via a NULL pointer dereference. Suggested-by: Peter Maydell Reviewed-by: Li Qiang Reviewed-by: Peter Maydell Signed-off-by: Prasad J Pandit Reviewed-by: Philippe Mathieu-Daudé --- softmmu/memory.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Update v4: add Reviewed-by tag -> https://lists.nongnu.org/archive/html/qemu-devel/2020-07/msg05324.html diff --git a/softmmu/memory.c b/softmmu/memory.c index af25987518..1f4b37b3a6 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1485,7 +1485,13 @@ void memory_region_init_io(MemoryRegion *mr, uint64_t size) { memory_region_init(mr, owner, name, size); - mr->ops = ops ? ops : &unassigned_mem_ops; + if (ops) { + assert(ops->read || ops->read_with_attrs); + assert(ops->write || ops->write_with_attrs); + mr->ops = ops; + } else { + mr->ops = &unassigned_mem_ops; + } mr->opaque = opaque; mr->terminates = true; } @@ -1663,6 +1669,8 @@ void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, { Error *err = NULL; assert(ops); + assert(ops->read || ops->read_with_attrs); + assert(ops->write || ops->write_with_attrs); memory_region_init(mr, owner, name, size); mr->ops = ops; mr->opaque = opaque;