Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7985CC433EF for ; Tue, 29 Mar 2022 16:59:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A15518402F; Tue, 29 Mar 2022 18:59:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="S4LySbHP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C1288401F; Tue, 29 Mar 2022 18:59:27 +0200 (CEST) Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 000AA83FE4 for ; Tue, 29 Mar 2022 18:59:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=36zpDYgYKBoYk2m4vvqyyqvo.myw4-lyy3vs232.nox7.no@flex--ascull.bounces.google.com Received: by mail-wr1-x44a.google.com with SMTP id 15-20020adf808f000000b00203e488fa4eso5207556wrl.3 for ; Tue, 29 Mar 2022 09:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zyMiKgqYdJ147lNjfz6fi3ElvrFfd1HomAkEd227/VQ=; b=S4LySbHPRZ5i/qV63Wg5VHfue0M3W7mFzMuzxRHOcLFr0uTxPIVjhQGPTx398l6M7N oFaMY5KvyoLPQ5g1Pv38l8JaB19zq8TPcalMcLPgYifdtJ03aFQ9GBK4nFFZJ2pMojOR c1ggBLZtaXVYHpNKB8QL/WqJn/sYfbsPyBAkMwXmwOkgSgpurvj4NVq/vC1Q/EfaNiMz o+6Afsgg02x0D/uDroQifiQwBgqli05A/Nj9Y3Nl7cbWzR43dZ27n0pe5twHGiJmZE/x CtZuCgZRSuxtxxSrsuKmqra8skrSvcFHg4W6IC8zhKOBwHUGzmpByZqpvwDJ7d5xI4QD 0Hfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zyMiKgqYdJ147lNjfz6fi3ElvrFfd1HomAkEd227/VQ=; b=N3o0zIY5LMlWBaO8R4c4HAqcHcrMwdqOH5wnH3cXicg1u1RiiEYvWNjBSVl2F0E+xR zLFzpDpZUG0HG1LPBEPhw+rzciaZ3iGY4Hx8fdQrED9PJd1/owy0Ayijmh7f/EJYg5e+ PtxnwjtEg81iQZqTgNFYjc3KmVz/4Pk6oCDmynTTv9b4YW5kCnHKT/S6Oka0s3lI06kF afM0CIimq1pso4/k1Rh7FZUdFC55xXb7OD+/jQ86nE/FcASYHCILiHyBcZ0Pvu0UbOGE RqOn5CRI+srQmwOeB40VCyE2jSy7NiUo2u6Jd5a0W3hzWfkaXu6H60t/93AoovGxD3/7 4f3w== X-Gm-Message-State: AOAM532f8TmhdF7hCAGv4rvSPoeAVlJ4pKAsjVKEOyPvDSInIxjXrndu ltqVOUMzf9XmLcE1mDU4X0PLNHw7+VCxARonMKbTmYJ1pb0FjCywIMqgc3q+5JKMKNnQz8nzFj8 Ka5aJYnCJsXGgD4blQ2rbUcHTqyjyHstZjNE5QBc0D9FgKTFzIPJ5Kun3aPM= X-Google-Smtp-Source: ABdhPJyYuspB3CL7KWNLrv8Xm1IzpA9HmwtXdklAyRgezF0/4Y3BslQmmbE2QRsXIG+GIuSaccmX+J/fStw= X-Received: from ascull.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1510]) (user=ascull job=sendgmr) by 2002:a5d:424d:0:b0:204:7fc:d6c6 with SMTP id s13-20020a5d424d000000b0020407fcd6c6mr31410709wrr.291.1648573163509; Tue, 29 Mar 2022 09:59:23 -0700 (PDT) Date: Tue, 29 Mar 2022 16:58:44 +0000 In-Reply-To: <20220329165900.1139885-1-ascull@google.com> Message-Id: <20220329165900.1139885-3-ascull@google.com> Mime-Version: 1.0 References: <20220329165900.1139885-1-ascull@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 02/18] virtio: pci: Fix discovery of device config length From: Andrew Scull To: u-boot@lists.denx.de Cc: sjg@chromium.org, bmeng.cn@gmail.com, adelva@google.com, keirf@google.com, ptosi@google.com, Andrew Scull Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The length of the device config was erroneously being taken from the notify capability. Correct this by finding the length in the device capability. Fixes: 550435edf810 ("virtio: pci: Support non-legacy PCI transport device") Signed-off-by: Andrew Scull Reviewed-by: Bin Meng --- drivers/virtio/virtio_pci_modern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index fd8a1f3fec..55d25cb81b 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -497,7 +497,7 @@ static int virtio_pci_probe(struct udevice *udev) */ device = virtio_pci_find_capability(udev, VIRTIO_PCI_CAP_DEVICE_CFG); if (device) { - offset = notify + offsetof(struct virtio_pci_cap, length); + offset = device + offsetof(struct virtio_pci_cap, length); dm_pci_read_config32(udev, offset, &priv->device_len); } -- 2.35.1.1021.g381101b075-goog