From patchwork Tue Feb 7 07:49:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2708843wrn; Mon, 6 Feb 2023 23:52:42 -0800 (PST) X-Google-Smtp-Source: AK7set+k6BYECg9s4XML2zs13NFQrdWorx5Bg29JcKvt6FTMSoEOLy9Y2KA50a8DZbuyvi81oSsd X-Received: by 2002:a50:a41a:0:b0:4aa:b434:5a7b with SMTP id u26-20020a50a41a000000b004aab4345a7bmr2690188edb.12.1675756362018; Mon, 06 Feb 2023 23:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756362; cv=none; d=google.com; s=arc-20160816; b=VoIr19zhjveSioM+ikwbvhnHFQoppmmKgRNrDAAxf/p16mf5msmCMjvMdgToMYh8xC b4JpNxxUMW2v51DvSKSID3DBKNro4zwk9gOlGAl5EnxfwCUPLSk3l9MM7BRO0Jsp9Sxs KztpVgHI7F/OzYjsORQL1kENmRzrFxJ4tjjwPyXN0uncm1rEuuwo+fSt03O3QA5FZbmb X9MBqXXUO+rVoacpKAHDVr1dCkPp8iut3AIuPQj4hSFtA7e5KwL3S87H04HoFzymyd22 MvTJTO4M5MugWHabdCQLm0XN4EH/GHL/EJBzHmtJ7fMb9DZyG04YUPLpzTKZrtVeB6Tt 15Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=Z3Fz4ic+ruuxQNGx6fEsHOlcMxP7j3bu18u8mylit5o=; b=gv9Kt7WrG7dAd7pUod/gVumaxCRyJUPENwr7RJ1I9ugIUPcEQVUbbEdInk+pMP56I/ H+hadqFH0FR5F5qjWvmqp+iuyZFRA0QyNKwxPcUoxnEMUCgex3QMBys9cxRpo/rJuNCB gmfIMDFpDOnatdOR0Z+Mu6jhnngSDPrG6vlzFsdowJyUskM5etP1NQvb7cj/CrthyEad 0PC0PBQRu3kVZY6epOqm53MIXL6G6BDwG8AUSAEFe4vl1kcJDqiKCtCskRS36lbCsOJU 8LeRc9BDAuK0xBfsfGttLsWyIQ/32aKVlrwMxlvJ91WFoNE5x9UIk9leK3Idlutsz7F7 hwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ni4Q0W2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020aa7d297000000b004aaa098fe45si9858719edq.584.2023.02.06.23.52.18; Mon, 06 Feb 2023 23:52:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ni4Q0W2i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbjBGHuI (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjBGHuE (ORCPT ); Tue, 7 Feb 2023 02:50:04 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 565F61816A; Mon, 6 Feb 2023 23:50:03 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id D250820C7E2C; Mon, 6 Feb 2023 23:50:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D250820C7E2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756202; bh=Z3Fz4ic+ruuxQNGx6fEsHOlcMxP7j3bu18u8mylit5o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ni4Q0W2iTPiF3wS11jRxJyBitdCXRHvZCWHncfNA85jR20rMtGmgzINMywR3hD7LA 3sEfXrrS3qFMPUjYFXmyATl0VJy/Ssv7eEJgoDb5y/ju4FZY2VHzHDZu9KzcCXuKX4 UC7QiJnWd2CauD+3rGBy8pzK+UikkjAdtWn+2cgM= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 1/6] drivers/clocksource/hyper-v: non ACPI support in hyperv clock Date: Mon, 6 Feb 2023 23:49:54 -0800 Message-Id: <1675756199-5917-2-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757157902778094911?= X-GMAIL-MSGID: =?utf-8?q?1757157902778094911?= Add a placeholder function for the hv_setup_stimer0_irq API to accommodate systems without ACPI support. Since this function is not utilized on x86/x64 systems and non-ACPI support is only intended for x86/x64 systems, a placeholder function is sufficient for now and can be improved upon if necessary in the future. This change will make it easier to add device tree support for VMBus in subsequent commits. Signed-off-by: Saurabh Sengar Reviewed-by: Michael Kelley --- drivers/clocksource/hyperv_timer.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index c0cef92..f32948c 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -49,7 +49,7 @@ static int stimer0_irq = -1; static int stimer0_message_sint; -static DEFINE_PER_CPU(long, stimer0_evt); +static __maybe_unused DEFINE_PER_CPU(long, stimer0_evt); /* * Common code for stimer0 interrupts coming via Direct Mode or @@ -68,7 +68,7 @@ void hv_stimer0_isr(void) * stimer0 interrupt handler for architectures that support * per-cpu interrupts, which also implies Direct Mode. */ -static irqreturn_t hv_stimer0_percpu_isr(int irq, void *dev_id) +static irqreturn_t __maybe_unused hv_stimer0_percpu_isr(int irq, void *dev_id) { hv_stimer0_isr(); return IRQ_HANDLED; @@ -196,6 +196,7 @@ void __weak hv_remove_stimer0_handler(void) { }; +#ifdef CONFIG_ACPI /* Called only on architectures with per-cpu IRQs (i.e., not x86/x64) */ static int hv_setup_stimer0_irq(void) { @@ -230,6 +231,16 @@ static void hv_remove_stimer0_irq(void) stimer0_irq = -1; } } +#else +static int hv_setup_stimer0_irq(void) +{ + return 0; +} + +static void hv_remove_stimer0_irq(void) +{ +} +#endif /* hv_stimer_alloc - Global initialization of the clockevent and stimer0 */ int hv_stimer_alloc(bool have_percpu_irqs) From patchwork Tue Feb 7 07:49:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2708849wrn; Mon, 6 Feb 2023 23:52:43 -0800 (PST) X-Google-Smtp-Source: AK7set9x7AZvHF2X8dmY1PuTYCljfiOBYPPv/jDS++oo969Hjv6aXR4VGNrmXjksP/h+z37c0ISE X-Received: by 2002:a50:d4cc:0:b0:4aa:a8e7:c04c with SMTP id e12-20020a50d4cc000000b004aaa8e7c04cmr2443189edj.21.1675756363223; Mon, 06 Feb 2023 23:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756363; cv=none; d=google.com; s=arc-20160816; b=SmiTWY4TM0Bv1WPu+QTOa0xE3pYPw2DeWpkI2AaeBJ3lp6Fubd8BkAiuDauTelaqE8 pM4QeTc23LL2ym9WyomiBmOm08FAKs9DREzbaGWZJMsqqAziJwzKRTqf5GQ9nVxqPTBz dr5gSNgYVOVHdPF92aN+JgXaa4zw1pQrX9Z5A9+0SZUQqhhB8y54DOxmBAqUv/58M76v XjbFq3Yw3tI1BVc/YDF4G2uyTbGfHNPn03TL3Y2XGOFFk2FTlq+QfQncOWNzGwAqz4HI uaPwGhLqSIHG+alz7AGr3ynvciMmPd8Str/zTEJFPFzDdaNZ+ECJRaKBrTCTVrLwxKQa Tfyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=m27CpggRo4AF+8YjkrkT62CF9pWm8xzxwR5YS2mWWsk=; b=s4ztkDVHL2ADtdCfZmBKZQo8YWhHmZKjZV8re7/b9HXcTrhF9Aqw3Ub+zkOL6whmPl +aj2TyjFkFs9XnFHgurcohFGaENmxTz3jqXEqyJLousHxuuPUoiaxgNfpksh6EArthhh YzOnWwwwvkINouTbm/JGC9hdeUBd2F+MKoBBgMrrCW+zwSOyCgxIGuMagDL//2L/Eq9V Ue80KT0c4p/7A2+ZwwV2f0jBA6kqNu2yXAKvjcyBKjqT5WgO3U3WEi2HBujoyob7gZ2N oeex1cQzFh9wxDW4pAC5GCpMuxmYmevb1B5VjqbLgB/+XHFZcyWLMgNcA3motbC+b/eN lC2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ITVHd11B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gc21-20020a1709072b1500b0088d90504560si14616258ejc.30.2023.02.06.23.52.20; Mon, 06 Feb 2023 23:52:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ITVHd11B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjBGHuM (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbjBGHuE (ORCPT ); Tue, 7 Feb 2023 02:50:04 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7443E18B20; Mon, 6 Feb 2023 23:50:03 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id EA79720C7E2D; Mon, 6 Feb 2023 23:50:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EA79720C7E2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756203; bh=m27CpggRo4AF+8YjkrkT62CF9pWm8xzxwR5YS2mWWsk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ITVHd11BBEY1XV/RW1GFECrDc3DvZ6cNR4GgynqIV6y3JmaqQ/J6byoGKvvLhG5c/ FkFbIcbmCOMjjCCeyJxaL/uV5+oEU2Jc031kH0OKPziTDGE66x4KzotxmmGYobc1VX cyk2MFzupAUSSPJz2AZjSIcvViRyX0OdSmkXgFps= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 2/6] Drivers: hv: allow non ACPI compilation for hv_is_hibernation_supported Date: Mon, 6 Feb 2023 23:49:55 -0800 Message-Id: <1675756199-5917-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757157904108824813?= X-GMAIL-MSGID: =?utf-8?q?1757157904108824813?= acpi_sleep_state_supported API is only define for CONFIG_ACPI flag and thus it can't be used for non-ACPI builds. Initially there won't be hibernation support for non ACPI builds. This change will help adding device tree support in subsequent commits. Signed-off-by: Saurabh Sengar Reviewed-by: Michael Kelley --- drivers/hv/hv_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 52a6f89..370ec20 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -234,7 +234,11 @@ void hv_setup_dma_ops(struct device *dev, bool coherent) bool hv_is_hibernation_supported(void) { +#ifdef CONFIG_ACPI return !hv_root_partition && acpi_sleep_state_supported(ACPI_STATE_S4); +#else + return false; +#endif } EXPORT_SYMBOL_GPL(hv_is_hibernation_supported); From patchwork Tue Feb 7 07:49:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2709081wrn; Mon, 6 Feb 2023 23:53:26 -0800 (PST) X-Google-Smtp-Source: AK7set8JNY8jR7ozxsN4akd6MBnpoLKN90tl+GlTmTOAcMH2/yeamj1+imOo6URVqXXXaQ/irTe1 X-Received: by 2002:a17:906:d156:b0:84d:3403:f4f2 with SMTP id br22-20020a170906d15600b0084d3403f4f2mr2479392ejb.62.1675756406099; Mon, 06 Feb 2023 23:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756406; cv=none; d=google.com; s=arc-20160816; b=QLhb/yYO7cOabsOKchGmuIJU4v0yakKKlgQf76f+L5YkK1wYgTTHCEMoVpANdcFXhp haUiYU11yUFekL0rrRZn1IPAv4wluVAPHJWUwxhgHCwjOrI1YwfYo+TZDQzogqcONqoO j+/hqanNMXewsh3kQHopAHsQcrGV7rBcIN8TmCbqjEggzcaYKmU2JFfNkUfDv4Mk9F4Q QSWOZKrEQ8cUf1NXnzxW79KtzW4AyPo+jNmZXQbcQ2oJOJpDIrUCY1msKxtswWUsoOxI ZnoEjcAQShJRiHaHr+rZ7nj/2g3iCyYbx4/wqCYEzMJGkHaRj7tifT7/6KYv3J4pJQNt Hhng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=L1jFvNrJkRlaJtMngQprF0W5dGHrerp9QNcY95pybS8=; b=vnauaQi2T8IiZgxGeNLnC6L8JgJLmJINv51zE07So1VWwBbZoiFDMjc6ZX3QD4IBrd M2XooA/MCR6m/WWzfcYeSeOsWTUfy2kbDieLX2aLJ3SwGrRv80Xu8T29AfOQli7BhlSu gIIPlLDaryT5uHEk/IltN/Tl3qsKVB9ahufk2hUDMPAuBQue7tO0KnnoHOzwu5km+fJc 39kozQe6uNE8eZyOutfvOFYGpOEH2NHStciepnJ4Z9BEryq6n2o1nCIjLv5p4VASEUT7 8YjLQLS412nf7dIrssK0NWc0TZMYhuajEw9fAZnvZqGw3RzirJEeHCqwrJJmghH97zWc jUoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=fOZN937K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 18-20020a170906021200b0084d354539d7si19829587ejd.195.2023.02.06.23.53.03; Mon, 06 Feb 2023 23:53:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=fOZN937K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbjBGHuR (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbjBGHuF (ORCPT ); Tue, 7 Feb 2023 02:50:05 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81C5818B2A; Mon, 6 Feb 2023 23:50:03 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 0E87E20C7E2E; Mon, 6 Feb 2023 23:50:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0E87E20C7E2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756203; bh=L1jFvNrJkRlaJtMngQprF0W5dGHrerp9QNcY95pybS8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fOZN937KCSVoII11uiltwmRypf7wTRt/X0EiCyAXe21oA/tbrLQA3mR9GinXnPc+Q /3QPPRB9UdLStNSurK60aVC5wC3nIT6cxGA9PpAlotLnBHWYRyyOqFT33cNmBHjoa0 b22MEYgLvGblMALcBp+UTM4v2x7k2bILZRXIyiMc= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 3/6] Drivers: hv: vmbus: Convert acpi_device to more generic platform_device Date: Mon, 6 Feb 2023 23:49:56 -0800 Message-Id: <1675756199-5917-4-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757157949064260811?= X-GMAIL-MSGID: =?utf-8?q?1757157949064260811?= Use more generic platform device instead of acpi device. Also rename the function vmbus_acpi_remove to more generic name vmbus_mmio_remove. Signed-off-by: Saurabh Sengar Reviewed-by: Michael Kelley --- [V4] - rebased which fixed return type of 'vmbus_mmio_remove' from int to void drivers/hv/vmbus_drv.c | 58 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index d24dd65..7349715 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ struct vmbus_dynid { struct hv_vmbus_device_id id; }; -static struct acpi_device *hv_acpi_dev; +static struct device *hv_dev; static int hyperv_cpuhp_online; @@ -143,7 +144,7 @@ static int hv_die_panic_notify_crash(struct notifier_block *self, static int vmbus_exists(void) { - if (hv_acpi_dev == NULL) + if (hv_dev == NULL) return -ENODEV; return 0; @@ -932,7 +933,7 @@ static int vmbus_dma_configure(struct device *child_device) * On x86/x64 coherence is assumed and these calls have no effect. */ hv_setup_dma_ops(child_device, - device_get_dma_attr(&hv_acpi_dev->dev) == DEV_DMA_COHERENT); + device_get_dma_attr(hv_dev) == DEV_DMA_COHERENT); return 0; } @@ -2090,7 +2091,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) &child_device_obj->channel->offermsg.offer.if_instance); child_device_obj->device.bus = &hv_bus; - child_device_obj->device.parent = &hv_acpi_dev->dev; + child_device_obj->device.parent = hv_dev; child_device_obj->device.release = vmbus_device_release; child_device_obj->device.dma_parms = &child_device_obj->dma_parms; @@ -2262,7 +2263,7 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) return AE_OK; } -static void vmbus_acpi_remove(struct acpi_device *device) +static void vmbus_mmio_remove(void) { struct resource *cur_res; struct resource *next_res; @@ -2441,13 +2442,14 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); -static int vmbus_acpi_add(struct acpi_device *device) +static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; int ret_val = -ENODEV; struct acpi_device *ancestor; + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); - hv_acpi_dev = device; + hv_dev = &device->dev; /* * Older versions of Hyper-V for ARM64 fail to include the _CCA @@ -2489,10 +2491,21 @@ static int vmbus_acpi_add(struct acpi_device *device) acpi_walk_err: if (ret_val) - vmbus_acpi_remove(device); + vmbus_mmio_remove(); return ret_val; } +static int vmbus_platform_driver_probe(struct platform_device *pdev) +{ + return vmbus_acpi_add(pdev); +} + +static int vmbus_platform_driver_remove(struct platform_device *pdev) +{ + vmbus_mmio_remove(); + return 0; +} + #ifdef CONFIG_PM_SLEEP static int vmbus_bus_suspend(struct device *dev) { @@ -2658,15 +2671,15 @@ static int vmbus_bus_resume(struct device *dev) .restore_noirq = vmbus_bus_resume }; -static struct acpi_driver vmbus_acpi_driver = { - .name = "vmbus", - .ids = vmbus_acpi_device_ids, - .ops = { - .add = vmbus_acpi_add, - .remove = vmbus_acpi_remove, - }, - .drv.pm = &vmbus_bus_pm, - .drv.probe_type = PROBE_FORCE_SYNCHRONOUS, +static struct platform_driver vmbus_platform_driver = { + .probe = vmbus_platform_driver_probe, + .remove = vmbus_platform_driver_remove, + .driver = { + .name = "vmbus", + .acpi_match_table = ACPI_PTR(vmbus_acpi_device_ids), + .pm = &vmbus_bus_pm, + .probe_type = PROBE_FORCE_SYNCHRONOUS, + } }; static void hv_kexec_handler(void) @@ -2750,12 +2763,11 @@ static int __init hv_acpi_init(void) /* * Get ACPI resources first. */ - ret = acpi_bus_register_driver(&vmbus_acpi_driver); - + ret = platform_driver_register(&vmbus_platform_driver); if (ret) return ret; - if (!hv_acpi_dev) { + if (!hv_dev) { ret = -ENODEV; goto cleanup; } @@ -2785,8 +2797,8 @@ static int __init hv_acpi_init(void) return 0; cleanup: - acpi_bus_unregister_driver(&vmbus_acpi_driver); - hv_acpi_dev = NULL; + platform_driver_unregister(&vmbus_platform_driver); + hv_dev = NULL; return ret; } @@ -2839,7 +2851,7 @@ static void __exit vmbus_exit(void) cpuhp_remove_state(hyperv_cpuhp_online); hv_synic_free(); - acpi_bus_unregister_driver(&vmbus_acpi_driver); + platform_driver_unregister(&vmbus_platform_driver); } From patchwork Tue Feb 7 07:49:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2709404wrn; Mon, 6 Feb 2023 23:54:22 -0800 (PST) X-Google-Smtp-Source: AK7set8tiupzrsoS3SNXvbqfco1+DTOrRBEJtItMYf6s1cWf+EZEjo5uk43kxDsrUll8Gb101n4e X-Received: by 2002:a17:902:c952:b0:198:bad1:3742 with SMTP id i18-20020a170902c95200b00198bad13742mr2216102pla.26.1675756462051; Mon, 06 Feb 2023 23:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756462; cv=none; d=google.com; s=arc-20160816; b=m4FW5dooGhyQ4RMfLkQy6Q2B9iT8jyVxtO+g/c4NlBU9Lte18PTlJC0rbx5CDrWPKH /PlDnzO5V3B3f3WyN5MKrHfGmYm8dTfQjlwt6eyLppDjfh9fKh0KIzf75+pW0/e/qKVY WEODzxEznaM5wNtm4NfQdIByy0JgjoPKtyw2DyB+gxmp2QDPqveiVry4hgWLTH+80qng pwtvlF7xlsDKllcqAQIk3gnP6gKUlotTZIQrHVuV6RuLLskFfnsGkMEJWesge/lA4o1y 7cluz+ynmpN5/zHI5aobXwQ27cghLESzmwVTvFBxaz86YAyFLEMJD3AKoWK5YLJL3xQk GEkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=mKpNmSIgrjwnpdItA6SeJ/oovZZXYlrfih5kK51feog=; b=0jAtxELe4XUvZn+01vRpD02RtqKbgc836IAFrngbwZOF4dbM7vhQJTmB1H6xJDjA6l DJYR4MwY5ObgmRpdeg8byYKB+pPbBmui+UVglHIB3EPFQeyJTP9K49BTFAKhrew3FqGr FDMcOa+FjR9SgaDwrDNYsySObhncXIzQcik7ugylNTo8Vk02GmYW2lM4ke+n6PfJDNxM SVubBZUMjev+4/+D7hZHj4EdeNTOAFpDpZKRt46Hwxcf0LLVc5nBGc/ZLZCMrRzvyO2h QHuEbstDPJzJHzl/BsYC+EqSxMnzBoNnNiYi/7HsSOgP+B+fchb6LzVXJ0EfIXbTlMat fnkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=R0SNKSjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a17090341ca00b00196766403a2si15197361ple.166.2023.02.06.23.54.08; Mon, 06 Feb 2023 23:54:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=R0SNKSjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjBGHuU (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbjBGHuF (ORCPT ); Tue, 7 Feb 2023 02:50:05 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D8CF1E5D2; Mon, 6 Feb 2023 23:50:03 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 2734720C7E2F; Mon, 6 Feb 2023 23:50:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2734720C7E2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756203; bh=mKpNmSIgrjwnpdItA6SeJ/oovZZXYlrfih5kK51feog=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R0SNKSjcaz3wSPXL2zVGuCdBX1jPSIPMYo2+sMKaCaKtvv7Xb0HwbpJcvrdOokItX tBSS8HoQT13yq4tDZTdC8A/AZnEb9kFCPJFx33qyr2IEREn89LkIxBbFBHslZKvf3f Z4U1/eDnHX9whprI4g6RpF4S95C0qnw9T1WW9s2s= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 4/6] dt-bindings: hypervisor: Rename virtio to hypervisor Date: Mon, 6 Feb 2023 23:49:57 -0800 Message-Id: <1675756199-5917-5-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757158007758008160?= X-GMAIL-MSGID: =?utf-8?q?1757158007758008160?= Rename virtio folder to more generic hypervisor, so that this can accommodate more devices of similar type. Signed-off-by: Saurabh Sengar --- Documentation/devicetree/bindings/gpio/gpio-virtio.yaml | 4 ++-- Documentation/devicetree/bindings/{virtio => hypervisor}/mmio.yaml | 2 +- .../devicetree/bindings/{virtio => hypervisor}/pci-iommu.yaml | 2 +- .../devicetree/bindings/{virtio => hypervisor}/virtio-device.yaml | 2 +- Documentation/devicetree/bindings/i2c/i2c-virtio.yaml | 4 ++-- MAINTAINERS | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename Documentation/devicetree/bindings/{virtio => hypervisor}/mmio.yaml (95%) rename Documentation/devicetree/bindings/{virtio => hypervisor}/pci-iommu.yaml (98%) rename Documentation/devicetree/bindings/{virtio => hypervisor}/virtio-device.yaml (93%) diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml index 601d857..e08ed2a 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml +++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml @@ -10,10 +10,10 @@ maintainers: - Viresh Kumar allOf: - - $ref: /schemas/virtio/virtio-device.yaml# + - $ref: /schemas/hypervisor/virtio-device.yaml# description: - Virtio GPIO controller, see /schemas/virtio/virtio-device.yaml for more + Virtio GPIO controller, see /schemas/hypervisor/virtio-device.yaml for more details. properties: diff --git a/Documentation/devicetree/bindings/virtio/mmio.yaml b/Documentation/devicetree/bindings/hypervisor/mmio.yaml similarity index 95% rename from Documentation/devicetree/bindings/virtio/mmio.yaml rename to Documentation/devicetree/bindings/hypervisor/mmio.yaml index 0aa8433..8492c9b 100644 --- a/Documentation/devicetree/bindings/virtio/mmio.yaml +++ b/Documentation/devicetree/bindings/hypervisor/mmio.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/mmio.yaml# +$id: http://devicetree.org/schemas/hypervisor/mmio.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: virtio memory mapped devices diff --git a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml b/Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml similarity index 98% rename from Documentation/devicetree/bindings/virtio/pci-iommu.yaml rename to Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml index 972a785..52de535 100644 --- a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml +++ b/Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/pci-iommu.yaml# +$id: http://devicetree.org/schemas/hypervisor/pci-iommu.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: virtio-iommu device using the virtio-pci transport diff --git a/Documentation/devicetree/bindings/virtio/virtio-device.yaml b/Documentation/devicetree/bindings/hypervisor/virtio-device.yaml similarity index 93% rename from Documentation/devicetree/bindings/virtio/virtio-device.yaml rename to Documentation/devicetree/bindings/hypervisor/virtio-device.yaml index 8c6919b..7b8d93b 100644 --- a/Documentation/devicetree/bindings/virtio/virtio-device.yaml +++ b/Documentation/devicetree/bindings/hypervisor/virtio-device.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/virtio-device.yaml# +$id: http://devicetree.org/schemas/hypervisor/virtio-device.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Virtio device diff --git a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml index 7d87ed8..99a0ce2 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml @@ -11,10 +11,10 @@ maintainers: allOf: - $ref: /schemas/i2c/i2c-controller.yaml# - - $ref: /schemas/virtio/virtio-device.yaml# + - $ref: /schemas/hypervisor/virtio-device.yaml# description: - Virtio I2C device, see /schemas/virtio/virtio-device.yaml for more details. + Virtio I2C device, see /schemas/hypervisor/virtio-device.yaml for more details. properties: $nodename: diff --git a/MAINTAINERS b/MAINTAINERS index f76ca28..27a5650 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21977,7 +21977,7 @@ L: virtualization@lists.linux-foundation.org S: Maintained F: Documentation/ABI/testing/sysfs-bus-vdpa F: Documentation/ABI/testing/sysfs-class-vduse -F: Documentation/devicetree/bindings/virtio/ +F: Documentation/devicetree/bindings/hypervisor/ F: Documentation/driver-api/virtio/ F: drivers/block/virtio_blk.c F: drivers/crypto/virtio/ From patchwork Tue Feb 7 07:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2708857wrn; Mon, 6 Feb 2023 23:52:44 -0800 (PST) X-Google-Smtp-Source: AK7set81+28ILb9gqueDLeFjnxKKyNI2lZ1Cl+rXoX/6WNCKRzy4F7lgu2WxM0BTviGDppFYdrtT X-Received: by 2002:a17:906:3e86:b0:895:58be:94a with SMTP id a6-20020a1709063e8600b0089558be094amr2608176ejj.14.1675756364650; Mon, 06 Feb 2023 23:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756364; cv=none; d=google.com; s=arc-20160816; b=fRCKtfY4AaZTEN2xLP0Sq8eezlAMQ5yQE0y0LRBIjobHUFnZ1LqVFtEuSPDYy6hLi3 2+MEJLdOc6QZ1yd7+0AbrbodnK4ZF5NDOPQSCUe+RUPj0rpZopAKldu2CaV5A3EC/pP2 Nku+kwSQRNeBGuSCcMO5wI56C/okdGZ9+plAHFeKwHXraieKapUdNf60CRST02FoXwiE J+pZcEDqr0UB4oN6wqqbt+/V13YPH1rzrSnOytuzOLOPc9UOmzJh5c5rAnz8seb4PYD7 C0bwlbeB1Dp+xOqJtN2T1vznnL/jJELt6TfJBeIPnutn9u5iST008alTNUU+eqouJy40 QkCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=LRgFTNEcHuGtL1aCGDTqe/YCQf0md08qX7Nvqfh3cLA=; b=AmYE6S1LN4msWtN9McQwm8eQc8xVU+NsVBqf1vbqYe1dSwCa1wqMPWrOawUUB6+7C0 ahczIp/Rmmq9zQzszqCc+vIGSRdaP3ENRnPizvvR9PW5ihxOx/q3ZPWJofLNFPwTWMW0 Z6zai+ZK0af03AQSg3EfSh0a9fVPX8as8+jkmeLLVZ9nD3IBP0V39AhL3/rGhp4byfbv /a+S5Q3zlMVUlzxqxTXQQfwM+s69VK2+v5fHnE1HAwsKdbWf8ejwnVSxPfZxjB54ODLe 3afGlHRcwktKRVBFtYNbv5gRax2+fhnnrr1Ss5j5KT1e3fEIU8kyDbOUlV1VyygklqB7 GUPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=U60bue7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a1709060a4a00b008849f421ec4si17366330ejf.576.2023.02.06.23.52.21; Mon, 06 Feb 2023 23:52:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=U60bue7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjBGHuO (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbjBGHuF (ORCPT ); Tue, 7 Feb 2023 02:50:05 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78CE9227BC; Mon, 6 Feb 2023 23:50:04 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 3FBDF20C7E30; Mon, 6 Feb 2023 23:50:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3FBDF20C7E30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756203; bh=LRgFTNEcHuGtL1aCGDTqe/YCQf0md08qX7Nvqfh3cLA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U60bue7ngIy2B6t3eElkHR7hOvzNnrqQ8uFUjIRv6hYGfU2N8vuD1hFIoiEtvDaJV IQs7Xo7nhbO1BM3PtSZr1WHeoTG0YuMnuO0LDxCHeoZrRC5ZKmIPELKhK1f/G8idwl Y1kFp5BWlQA8q3rsG6lRLNXsvVCDVGDXrN6vaio8= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 5/6] dt-bindings: hypervisor: VMBus Date: Mon, 6 Feb 2023 23:49:58 -0800 Message-Id: <1675756199-5917-6-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757157905543173983?= X-GMAIL-MSGID: =?utf-8?q?1757157905543173983?= Add dt-bindings for Hyper-V VMBus. Signed-off-by: Saurabh Sengar --- .../bindings/hypervisor/microsoft,vmbus.yaml | 48 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml diff --git a/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml new file mode 100644 index 0000000..a9c43a6 --- /dev/null +++ b/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hypervisor/microsoft,vmbus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microsoft Hyper-V VMBus + +maintainers: + - Saurabh Sengar + +description: + VMBus is a software bus that implement the protocols for communication + between the root or host OS and guest OSs (virtual machines). + +properties: + compatible: + const: microsoft,vmbus + + ranges: true + + '#address-cells': + const: 2 + + '#size-cells': + const: 1 + +required: + - compatible + - ranges + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + + vmbus@ff0000000 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "microsoft,vmbus"; + ranges = <0x0f 0xf0000000 0x0f 0xf0000000 0x10000000>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 27a5650..669f1c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9490,6 +9490,7 @@ S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git F: Documentation/ABI/stable/sysfs-bus-vmbus F: Documentation/ABI/testing/debugfs-hyperv +F: Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml F: Documentation/virt/hyperv F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst F: arch/arm64/hyperv From patchwork Tue Feb 7 07:49:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 53772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2709413wrn; Mon, 6 Feb 2023 23:54:24 -0800 (PST) X-Google-Smtp-Source: AK7set8WiQkyZdn6Mgtj9slS9pUOlkSXfLSw4KZSVMTrwI5uHBg6DZHJpqxRJjsU5JG1uWN/mADE X-Received: by 2002:aa7:9aef:0:b0:593:adeb:39a9 with SMTP id y15-20020aa79aef000000b00593adeb39a9mr2457277pfp.33.1675756463722; Mon, 06 Feb 2023 23:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675756463; cv=none; d=google.com; s=arc-20160816; b=U5PNqGFZFpveZyl/M2HCy8bB5aaOXNBDmbktzIlmGYSsJTBlKqHPHjP31GWjqsvZfI YqWPVTl27xWFEZjzVdMaG/AxspX8KTG356dMRhcIH+7adkHyuuhJIG7rvDMs75Y5+2w/ d0fqZTld87PpOEBBjAdhSkGWl7bHExsh55JymlZId04D5YmyLk/R8erVyxmy0OA75Dcf IX+qn5mNPNhEohMrWfvS2PeMRUf1I2mVsRCkbjgZ2JxUoBgXQORZSEQ4Jn1yH2CeJuCF sb1LctGeRmnUfvr5HSO/+93OkVi5jaFo6Q1Ah34zKnubz+SttfvAFPyZxJWYvhFyzZMy TY/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter; bh=qvXsJpgHQiFB3Phr4UYarQ/CGWW+zSQX/ORJm9VS1wA=; b=c8YmxISTg1KYIwWBtmNX1Z1L/YplQPz4BYuq5r94zi6y8NnXWH6TixIPMumoYCtQLR DwAczfdbFTXPrSjRjB+8NIvpWjKU09YsW1FJ9J52O4a+dBeuvJepm7TEblShWj1ZP4WM VyEoxeHDxgMPmQP6b6NVklXX+CWukuwCJMlc9h9Ey+QKNvXqblH5qQPz7EztLWPSv/ZG fEmIijXGw5d3+u0fPfLsgUD6Gh3/Yo6yIabOihiX4WS4eQRBdumVMzSndI9DGaHZUfWt /JIQldy/xHCV2dWdSm4XW5sMv1lo2p/Jt8+VMB2r4RMv+B+m/NJVMSSxkohZndhHaGhN VbxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=P7Xjp7FG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020aa794a3000000b005944e1239besi13157051pfl.68.2023.02.06.23.54.11; Mon, 06 Feb 2023 23:54:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=P7Xjp7FG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbjBGHuY (ORCPT + 99 others); Tue, 7 Feb 2023 02:50:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbjBGHuF (ORCPT ); Tue, 7 Feb 2023 02:50:05 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 783D020D34; Mon, 6 Feb 2023 23:50:04 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 5864E20C7E31; Mon, 6 Feb 2023 23:50:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5864E20C7E31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675756203; bh=qvXsJpgHQiFB3Phr4UYarQ/CGWW+zSQX/ORJm9VS1wA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P7Xjp7FG3ZLu+Mh05imc4yqgtipn8j70PU99vGNOPPPWX2dkplJ2cvXNHG3vYeFJh VBUpwiSfz+pyyg8M8pJJy6aApkOh5wjtABUCcNhqxUiQQP/hZTubKAolJoscXsa2VN 5bwAatCBGTyu9ECfunxtwY1wDDBrTkyWxqCg56i8= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v4 6/6] Driver: VMBus: Add device tree support Date: Mon, 6 Feb 2023 23:49:59 -0800 Message-Id: <1675756199-5917-7-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> References: <1675756199-5917-1-git-send-email-ssengar@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757158009906440582?= X-GMAIL-MSGID: =?utf-8?q?1757158009906440582?= Update the driver to support device tree boot as well along with ACPI. At present the device tree parsing only provides the mmio region info and is not the exact copy of ACPI parsing. This is sufficient to cater all the current device tree usecases for VMBus. Currently device tree is supported only for x86 systems. Signed-off-by: Saurabh Sengar --- [V4] - used __maybe_unused for 'vmbus_of_match' and safeguard vmbus_acpi_device_ids under #ifdef drivers/hv/Kconfig | 4 ++-- drivers/hv/vmbus_drv.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 0747a8f..7e44d42 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -4,8 +4,8 @@ menu "Microsoft Hyper-V guest support" config HYPERV tristate "Microsoft Hyper-V client drivers" - depends on ACPI && ((X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \ - || (ARM64 && !CPU_BIG_ENDIAN)) + depends on (X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \ + || (ACPI && ARM64 && !CPU_BIG_ENDIAN) select PARAVIRT select X86_HV_CALLBACK_VECTOR if X86 select VMAP_PFN diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 7349715..1774cae 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -2152,7 +2153,7 @@ void vmbus_device_unregister(struct hv_device *device_obj) device_unregister(&device_obj->device); } - +#ifdef CONFIG_ACPI /* * VMBUS is an acpi enumerated device. Get the information we * need from DSDT. @@ -2262,6 +2263,7 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) return AE_OK; } +#endif static void vmbus_mmio_remove(void) { @@ -2282,7 +2284,7 @@ static void vmbus_mmio_remove(void) } } -static void vmbus_reserve_fb(void) +static void __maybe_unused vmbus_reserve_fb(void) { resource_size_t start = 0, size; struct pci_dev *pdev; @@ -2442,6 +2444,7 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); +#ifdef CONFIG_ACPI static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; @@ -2494,10 +2497,52 @@ static int vmbus_acpi_add(struct platform_device *pdev) vmbus_mmio_remove(); return ret_val; } +#else + +static int vmbus_device_add(struct platform_device *pdev) +{ + struct resource **cur_res = &hyperv_mmio; + struct of_range range; + struct of_range_parser parser; + struct device_node *np; + int ret = 0; + + hv_dev = &pdev->dev; + np = pdev->dev.of_node; + + ret = of_range_parser_init(&parser, np); + if (ret) { + dev_err(hv_dev, "Failed to parse resources.\n"); + return ret; + } + + for_each_of_range(&parser, &range) { + struct resource *res; + + res = kzalloc(sizeof(*res), GFP_ATOMIC); + if (!res) + return -ENOMEM; + + res->name = "hyperv mmio"; + res->flags = IORESOURCE_MEM | IORESOURCE_MEM_64; + res->start = range.pci_addr; + res->end = range.pci_addr + range.size; + + *cur_res = res; + cur_res = &res->sibling; + } + + return ret; +} +#endif static int vmbus_platform_driver_probe(struct platform_device *pdev) { +#ifdef CONFIG_ACPI return vmbus_acpi_add(pdev); +#else + return vmbus_device_add(pdev); +#endif } static int vmbus_platform_driver_remove(struct platform_device *pdev) @@ -2643,12 +2688,24 @@ static int vmbus_bus_resume(struct device *dev) #define vmbus_bus_resume NULL #endif /* CONFIG_PM_SLEEP */ +static const struct __maybe_unused of_device_id vmbus_of_match[] = { + { + .compatible = "microsoft,vmbus", + }, + { + /* sentinel */ + }, +}; +MODULE_DEVICE_TABLE(of, vmbus_of_match); + +#ifdef CONFIG_ACPI static const struct acpi_device_id vmbus_acpi_device_ids[] = { {"VMBUS", 0}, {"VMBus", 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, vmbus_acpi_device_ids); +#endif /* * Note: we must use the "no_irq" ops, otherwise hibernation can not work with @@ -2677,6 +2734,7 @@ static int vmbus_bus_resume(struct device *dev) .driver = { .name = "vmbus", .acpi_match_table = ACPI_PTR(vmbus_acpi_device_ids), + .of_match_table = of_match_ptr(vmbus_of_match), .pm = &vmbus_bus_pm, .probe_type = PROBE_FORCE_SYNCHRONOUS, }