From patchwork Wed Jan 4 13:39:30 2023 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: 639039 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1749411pvb; Wed, 4 Jan 2023 05:42:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFLgySOSRjS7c/CUkh88h+DRXS3qo5k/5Y0c41QjYMnYU/YWNeAPlcb441/POMeDg+P5B7 X-Received: by 2002:a05:622a:244c:b0:3a8:1635:ae5e with SMTP id bl12-20020a05622a244c00b003a81635ae5emr64909235qtb.39.1672839736007; Wed, 04 Jan 2023 05:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672839735; cv=none; d=google.com; s=arc-20160816; b=Wws/jzoWImnoQa4EYxLOKnauFT9n54j3JWBZVwKBOStAIYOb+/dTDMz9bXeOIGsgbq M9vEBCGKMl12czDNs9lJgwXflD2FOhM3inP4rMfSyB9YBuv29qlPpeiAgZjZu4STH+QB ZZwLrrgQvb89L6nw/nbKINxTbL/RHw4vFZUVoYr4ZNTD+EnQAFnPMpk+Y6s0KaQWk187 n93zkAWcEqS3z1cgEgUVf5Dqg72mTeq5iYFtg8GAUHze+OQPVmMYuC0bdK0glXENFccT HQo/uFa5Ioq4EpMHHVB6ZgsImqls47NyrnQ41BwuDgbdOZ377FlvxaL3wqB6bqVHEWTV pxjw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E0jD820lsyDetFSkA1XxZx75shSUmhMZjVO0KmjpJic=; b=Nsw+zTnWeFDBQz2Rht+prZYqJYZOABdCq//GBwTw+Sjdr2K0F0gKZdR/9CMR61KZas 3p0QyfY5uHVKTUuIfOEgv3UxmCoLo/RWZz/du2Elfo0jIMlXxQQOGynyLlIrqLDEbQHg J9v6jEvPZduynsmoCFfBu0FidF8s7fvx7ykunpHQDRjiT/FuRVL//GEAazFQree9RNSU EYEl4q0gjnT0a78cWGwrD01HMGNpFrc009HW34QW2WlNojj+pV5BwvZohm9aue61YayC EWX2vA+KWWySsrZ7jFcEGKilzkTLkbRb9B5Lj5RDMJcanRXSqTr2052B3lG7U890iQRv 3Dcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C9+LCnUp; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g25-20020ac87759000000b003a7f5e516b0si17081505qtu.592.2023.01.04.05.42.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jan 2023 05:42:15 -0800 (PST) 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=C9+LCnUp; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD3zi-0003cE-DI; Wed, 04 Jan 2023 08:39:50 -0500 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 1pD3zg-0003bo-1Y for qemu-devel@nongnu.org; Wed, 04 Jan 2023 08:39:48 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD3ze-0001Tq-CS for qemu-devel@nongnu.org; Wed, 04 Jan 2023 08:39:47 -0500 Received: by mail-wr1-x429.google.com with SMTP id j17so27622603wrr.7 for ; Wed, 04 Jan 2023 05:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=E0jD820lsyDetFSkA1XxZx75shSUmhMZjVO0KmjpJic=; b=C9+LCnUpiIhP7a3tMDtjoraBbXgzz/uAXZODg5+qaifgoAGd7rC6kuk3+WemmiGEgc 2SIFfG2U8hlb6arfcB1Ffg8kuF9L3p+bQrmTP2S7s1MUE6cGXXOaNKakDAkQLzfewyse E7T3MJ02fvYrciBB4if6SKTbAxlT3m3T3LD+K+RknA+qJzLdPcasFSFdULUK0SS9MCC7 uJBi0joYAOnhq6ZyDbeYIyRZjMm28M8vqz/XirdzQfWTjJ1otOOIREYoytDqtAXCV9+n GX0UREbUqIxNdfVXs0rmxYL3mmB5/J4Mn0hvfu/4iIWejW37Gz8COIplbiQmM4hZjNTY huGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=E0jD820lsyDetFSkA1XxZx75shSUmhMZjVO0KmjpJic=; b=7kez+puHQ/0n/Xy+KdaTrQW34K2JKKmsL1vokIjuha3iy9eCBbYycgC+J46Yfeie65 Sw53IPDEKbx0U7YnSQUXgAtL8lZ3xl8jHSpFw/LhJ+rHir4vT/wawbqfORKQbH8OxxQ1 w0ajODEr6f45zpGg7OVjsYuTTxTuFuLoLasiEQ4Q2N8IiMAluSTxzv9HsZTDPEfnw7rb 9BpHFhF6LrKsxHpr4JyJW5GNE2NsKPWjDh/XF1dhMzrSgRpHPGY5olDv/coLrVa2blZ/ zM3JiivdpvCbvZU82ZGOnqO/plXNk/thFbqXIBgmnLx33LXCgQeq8+Kc45yiEy9nC9QX YEfg== X-Gm-Message-State: AFqh2kq4tAxLK1UiLUW6rWAm6xnvCRdFeYfoeEwrx1QTzI3Mxdy9hPmE bHCPCt1G2xq2cqETqIeByzUKZ80egXuhtfMJ X-Received: by 2002:a5d:6da6:0:b0:288:52a3:d0dc with SMTP id u6-20020a5d6da6000000b0028852a3d0dcmr25780321wrs.50.1672839583583; Wed, 04 Jan 2023 05:39:43 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c17-20020adffb51000000b0027cb20605e3sm26091150wrs.105.2023.01.04.05.39.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Jan 2023 05:39:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , Aurelien Jarno , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/6] hw/pci/pci_host: Trace config accesses on unexisting functions Date: Wed, 4 Jan 2023 14:39:30 +0100 Message-Id: <20230104133935.4639-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230104133935.4639-1-philmd@linaro.org> References: <20230104133935.4639-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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, 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.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 Currently we only emit trace events for existing PCI functions. In order to ease debugging PCI enumeration process, also emit for unexisting functions: $ qemu-system-foo -trace pci_cfg_\* ... pci_cfg_read empty 00:0a.4 @0x0 -> 0xffffffff pci_cfg_read empty 00:0a.5 @0x0 -> 0xffffffff pci_cfg_read empty 00:0a.6 @0x0 -> 0xffffffff pci_cfg_read empty 00:0a.7 @0x0 -> 0xffffffff pci_cfg_read pcnet 00:0b.0 @0x0 -> 0x20001022 pci_cfg_read empty 00:0c.0 @0x0 -> 0xffffffff pci_cfg_read empty 00:0d.0 @0x0 -> 0xffffffff pci_cfg_read empty 00:0e.0 @0x0 -> 0xffffffff pci_cfg_read empty 00:0f.0 @0x0 -> 0xffffffff pci_cfg_read empty 00:10.0 @0x0 -> 0xffffffff pci_cfg_read empty 00:11.0 @0x0 -> 0xffffffff pci_cfg_read cirrus-vga 00:12.0 @0x0 -> 0xb81013 Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci_host.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index eaf217ff55..ead1d3e61c 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -118,6 +118,9 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, unsigned len) uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) { + trace_pci_cfg_write("empty", extract32(addr, 16, 8), + extract32(addr, 11, 5), extract32(addr, 8, 3), + config_addr, val); return; } @@ -131,6 +134,9 @@ uint32_t pci_data_read(PCIBus *s, uint32_t addr, unsigned len) uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) { + trace_pci_cfg_read("empty", extract32(addr, 16, 8), + extract32(addr, 11, 5), extract32(addr, 8, 3), + config_addr, ~0x0); return ~0x0; }