From patchwork Mon Sep 13 10:47:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 509936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 421DDC433EF for ; Mon, 13 Sep 2021 10:47:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23ABD60FF2 for ; Mon, 13 Sep 2021 10:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239100AbhIMKtL (ORCPT ); Mon, 13 Sep 2021 06:49:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60958 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239094AbhIMKtL (ORCPT ); Mon, 13 Sep 2021 06:49:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631530075; 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; bh=jW3RSfCiVG035tkP4VV2MK7HMp8Gx524MEf00frh+Is=; b=LHPBXU5uIMV3lvi85Sg2rtrloI2LH/wPCm+bHqMUfAgKL8qt0VlKPMCH76lCSfzUgQmmV1 8OU18Q7lfc95w/+vrJb09FyrjU3HYqxzJDIK+Nz4PjPsTL+OtaZSOb75ItgeR0ktpesB2e x4A8yNUDHX0MfecAqWOH+8L3bJrxJxk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-xAstc3f-OYy7zh2AAGyTiQ-1; Mon, 13 Sep 2021 06:47:54 -0400 X-MC-Unique: xAstc3f-OYy7zh2AAGyTiQ-1 Received: by mail-ed1-f70.google.com with SMTP id y10-20020a056402270a00b003c8adc4d40cso4697312edd.15 for ; Mon, 13 Sep 2021 03:47:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=jW3RSfCiVG035tkP4VV2MK7HMp8Gx524MEf00frh+Is=; b=TXQAFYcZOXw8wXUGqg7PGOdpBY9Z5QV1GG+b4blKnANNwS4y/kPpkY8vxaDrbu+8Qd CUKhzBaOErleJvb28D6k4B8H8g9hSqc0CsLLMvGON3IQuoIlecuZg2dwNwbb2sMNSRkh az8imVcX4UGR4UWiEi5z6kaK/Fq3m9AFgM3AqbbwtglNMdyqKPWURBNqMljJTn20Xtw6 oEQzrQtzE09FY3+/rqgpk6KLMfbEwtBBZ54aEy114Kxb5yQZFA63r4C3ORIGb8n7UboA /7M2JMyo2cuMYNWWUlM4OTOP0q6jhJ5bqlDQBqJwoz1oejVhzrY1IuvtjgiTNTYbCYXr zPzw== X-Gm-Message-State: AOAM530uu8D7QvihoPFMX1ZVuaZy8pfKo8xOI5iNZGDx0XHudpwkad5Q CZMM/3yaa/GOO//eGwf3LrymFOmK/Ln6nd26rMGYJ1UYPKW35j/3Q8+1kZJRku++n/jJKQ1VN+8 aVhl8z2/ZKlQT7KKxqBJX4w== X-Received: by 2002:a17:906:269a:: with SMTP id t26mr7121208ejc.20.1631530072841; Mon, 13 Sep 2021 03:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUzxkOpFlkukF5bylBkxuLJ8coUNDVC3dmW/I3lxI4GHhcqqXeIdferB5ZUa/gtf5ATObe8g== X-Received: by 2002:a17:906:269a:: with SMTP id t26mr7121179ejc.20.1631530072612; Mon, 13 Sep 2021 03:47:52 -0700 (PDT) Received: from redhat.com ([2a03:c5c0:207f:418b:5703:fd4e:73dd:1986]) by smtp.gmail.com with ESMTPSA id o15sm3258041ejj.10.2021.09.13.03.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 03:47:52 -0700 (PDT) Date: Mon, 13 Sep 2021 06:47:46 -0400 From: "Michael S. Tsirkin" To: Alexey Kardashevskiy Cc: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker , Viresh Kumar , Vincent Guittot , Bill Mills , Alex =?utf-8?q?Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Arnd Bergmann Subject: [PATCH] virtio: don't fail on !of_device_is_compatible Message-ID: <20210913104640.85839-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org A recent change checking of_device_is_compatible on probe broke some powerpc/pseries setups. Apparently there virtio devices do not have a "compatible" property - they are matched by PCI vendor/device ids. Let's just skip of_node setup but proceed with initialization like we did previously. Fixes: 694a1116b405 ("virtio: Bind virtio device to device-tree node") Reported-by: Alexey Kardashevskiy Cc: Arnd Bergmann Cc: Viresh Kumar Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- Arnd could you help review this pls? Viresh is on vacation. drivers/virtio/virtio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index c46cc1fbc7ae..19a70a2361b4 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -347,8 +347,13 @@ static int virtio_device_of_init(struct virtio_device *dev) ret = snprintf(compat, sizeof(compat), "virtio,device%x", dev->id.device); BUG_ON(ret >= sizeof(compat)); + /* + * On powerpc/pseries virtio devices are PCI devices so PCI + * vendor/device ids play the role of the "compatible" property. + * Simply don't init of_node in this case. + */ if (!of_device_is_compatible(np, compat)) { - ret = -EINVAL; + ret = 0; goto out; }