From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 A8738C35250 for ; Sun, 9 Feb 2020 11:35:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7270220733 for ; Sun, 9 Feb 2020 11:35:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oqwUw25Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbgBILfq (ORCPT ); Sun, 9 Feb 2020 06:35:46 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39826 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726378AbgBILfq (ORCPT ); Sun, 9 Feb 2020 06:35:46 -0500 Received: by mail-wm1-f65.google.com with SMTP id c84so7399203wme.4 for ; Sun, 09 Feb 2020 03:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B0IdXZltvvU3REYmb4R5iXSctuV1F7mmZGfNkNXsTGQ=; b=oqwUw25QDsnczj0ffV1lgqOR9ummqiOBmmJVUv+PwjDYcp9/9TtJJ1L4SXVli4DSaU VrJc5H28RBQNglcoTCexAUZfzd7TKkPytR4mwFbhyR96K+v3RfcnNactz1chjjxsVHdu KgadqaKNZ25jqh/j+ttkUB62atGbSYltdJcRRAAATds0zJydBX3EPAF5glBYOqFD1QBY jIOQtiinuht5uAM5wKXnPZ2y1TFeMyBuC58JhV/Qac5i+xPsm2/j4E6kvGEEFAE5v/DS 4PIrVLMKMlKJcuIWNoc+n8FcwLfo0aISGX99CZ1tTok19HfI4Du9zq/SYf48g4EuNzjh GC9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B0IdXZltvvU3REYmb4R5iXSctuV1F7mmZGfNkNXsTGQ=; b=Ao0speVoJq2Ld3rNZwmjdL0jg/ZuADxmdICocigMJ1+K78H8GKowaUqNzTQG2/SZg7 YdvkJA2RZOVsmp6CLoBrFImTt5iZdHc/kiu1NosxQIWg28aVn/SkeTIGLa5/cwdo43PF /slWWLw7yI0MPtqIExpUYTLZu66MADt+pkgIJc1VHe/hWXhHq6e3GVL4XGqE4i68eNCa 3nilLY4bWxXCEzJ4fVlg7wWrRV2hiRoOKGffurkNhboUoIMvyU412vEHGXGTBt+9d65z 0RiizwCKPdQ18ANI1I1rOA8nur/19sD0lHCc/RcOktrOaBmT6zMzDcqb+6Evei/xyFlu 3Ouw== X-Gm-Message-State: APjAAAUUxg3i9X5V+9HyIjjjwb2ovfPo8nm8UYK9L2b7qmKUlbsHbAt1 3uPzVqjOyoBQbOfWHP9GjfO6/wt9Fc5n93DIq85cNw== X-Google-Smtp-Source: APXvYqya0smYjoKAUL0KrnH+vxJTYrcEJsBqPunbsV7AjIOwR3KkMPb6XPpVGk4o58xfE9zr1zXzsWz6IeFW0bbAR2Y= X-Received: by 2002:a1c:bc46:: with SMTP id m67mr9277922wmf.40.1581248144864; Sun, 09 Feb 2020 03:35:44 -0800 (PST) MIME-Version: 1.0 References: <20200206140352.6300-1-ardb@kernel.org> <20200206140352.6300-2-ardb@kernel.org> <20200209063907.fcwmwtiz2tjhjmol@wunner.de> In-Reply-To: <20200209063907.fcwmwtiz2tjhjmol@wunner.de> From: Ard Biesheuvel Date: Sun, 9 Feb 2020 12:35:33 +0100 Message-ID: Subject: Re: [PATCH 1/2] efi/libstub: add support for loading the initrd from a device path To: Lukas Wunner Cc: Ard Biesheuvel , linux-efi , linux-arm-kernel , Laszlo Ersek , Leif Lindholm , Peter Jones , Matthew Garrett , Alexander Graf , Ilias Apalodimas , Heinrich Schuchardt , Daniel Kiper Content-Type: text/plain; charset="UTF-8" Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Sun, 9 Feb 2020 at 07:50, Lukas Wunner wrote: > > On Thu, Feb 06, 2020 at 02:03:51PM +0000, Ard Biesheuvel wrote: > > --- a/drivers/firmware/efi/libstub/efistub.h > > +++ b/drivers/firmware/efi/libstub/efistub.h > > @@ -566,6 +566,14 @@ union efi_load_file_protocol { > > } mixed_mode; > > }; > > > > +struct efi_vendor_dev_path { > > + u8 type; > > + u8 sub_type; > > + u16 length; > > + efi_guid_t vendorguid; > > + u8 vendordata[]; > > +} __packed; > > In commit 46cd4b75cd0e ("efi: Add device path parser") I introduced a > struct efi_dev_path with a union for the type-specific data. Maybe > you can make use of it instead of introducing a new type? > That would make sense, but how do you take the size then? Perhaps it would be better to have a generic struct definition for the shared fields, struct definitions for the different types that use the generic type as the first fields, and a separate union that ties them altogether for the parser. > > > --- a/drivers/firmware/efi/libstub/efi-stub-helper.c > > +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c > > @@ -323,3 +323,68 @@ void efi_char16_printk(efi_char16_t *str) > > efi_call_proto(efi_table_attr(efi_system_table(), con_out), > > output_string, str); > > } > > + > > +static const struct { > > + struct efi_vendor_dev_path vendor; > > + struct efi_generic_dev_path end; > > +} __packed initrd_devpath = { > > Nit: Can we consistently stick to "dev_path" in lieu of "devpath"? > Sure. From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 CFC7CC35250 for ; Sun, 9 Feb 2020 11:36:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9162120733 for ; Sun, 9 Feb 2020 11:36:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rAb4hmRn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oqwUw25Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9162120733 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kWOo2jNWz/tEBe0rMpQLb4foDb6XZCffSpoyrjJTXC8=; b=rAb4hmRnpd+67s iPpEx1Xlv3LG+C8QvF2fPtY6MwKjylGZsFGcY3MwrLUFGQixxNiUB1K9zAuBavH7iqQYZKWr/uPVv nzfV8o8XQZa6aMaGn6LP0Izx/BtD/SrYxUqr3XytgWScfE/ubzW7ZhBVQp2adU6kxLOvq5zRomnya Oyy0QWFwndulCQvba8O6MqC9bUnrjBAwI8ZlIS7ClbpZeCBJhjuR6eZNH9EbqySeIqayqnCmQwL+H Nik8dkylQdfwhSAxZ2DWsFeknSIyD4esf1mp5KDNQ5y7URSELXZYwRTzQfGYyWNA4N/lEJY4B4HHi 1bC2edtBLP6Z3lDJQ17Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j0ksV-0006qI-0s; Sun, 09 Feb 2020 11:35:55 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j0ksR-0006pk-S6 for linux-arm-kernel@lists.infradead.org; Sun, 09 Feb 2020 11:35:53 +0000 Received: by mail-wm1-x344.google.com with SMTP id b17so7446291wmb.0 for ; Sun, 09 Feb 2020 03:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B0IdXZltvvU3REYmb4R5iXSctuV1F7mmZGfNkNXsTGQ=; b=oqwUw25QDsnczj0ffV1lgqOR9ummqiOBmmJVUv+PwjDYcp9/9TtJJ1L4SXVli4DSaU VrJc5H28RBQNglcoTCexAUZfzd7TKkPytR4mwFbhyR96K+v3RfcnNactz1chjjxsVHdu KgadqaKNZ25jqh/j+ttkUB62atGbSYltdJcRRAAATds0zJydBX3EPAF5glBYOqFD1QBY jIOQtiinuht5uAM5wKXnPZ2y1TFeMyBuC58JhV/Qac5i+xPsm2/j4E6kvGEEFAE5v/DS 4PIrVLMKMlKJcuIWNoc+n8FcwLfo0aISGX99CZ1tTok19HfI4Du9zq/SYf48g4EuNzjh GC9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B0IdXZltvvU3REYmb4R5iXSctuV1F7mmZGfNkNXsTGQ=; b=bFpWwltDggUtdaVOyLcQcVyHUZc8rtxyLnDTSnZcoAWoRFsnaFWBm4ZDRjnfqYLi5P lc8CXxmByFKwJiTVnu1cKOBV4n3IgEEvhTkZvEYsItTOeByfK6yxM0fuhGNwGoFyx4cP dp3NNa4wgS7LNLSuRYK7PYix0wmqwrurPk017Ix1aN7oa4qStejEInafccfuTrp6VTsI 5beHCJmdsi9GFoTsWvKeUPH2j+0oqDcTdU5cc1ItMOi4IU1brs1wTqLjGc4jnw0y7XEN D70u6IvlVjTcfSzlJ86Gnn6HrzyxgQHzofTaeVB+SHH/VRBn6NBlb4TDwmTEdW0DXBQV 527A== X-Gm-Message-State: APjAAAXdCdYEGBlZPW+WsY+CgmM/062L7LHLBQWBT2Z5tugj/07VXGA5 tKRToYS9Qe6XSqEX73kIDLbSlosp10wzuK1jBoelKg== X-Google-Smtp-Source: APXvYqya0smYjoKAUL0KrnH+vxJTYrcEJsBqPunbsV7AjIOwR3KkMPb6XPpVGk4o58xfE9zr1zXzsWz6IeFW0bbAR2Y= X-Received: by 2002:a1c:bc46:: with SMTP id m67mr9277922wmf.40.1581248144864; Sun, 09 Feb 2020 03:35:44 -0800 (PST) MIME-Version: 1.0 References: <20200206140352.6300-1-ardb@kernel.org> <20200206140352.6300-2-ardb@kernel.org> <20200209063907.fcwmwtiz2tjhjmol@wunner.de> In-Reply-To: <20200209063907.fcwmwtiz2tjhjmol@wunner.de> From: Ard Biesheuvel Date: Sun, 9 Feb 2020 12:35:33 +0100 Message-ID: Subject: Re: [PATCH 1/2] efi/libstub: add support for loading the initrd from a device path To: Lukas Wunner X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200209_033551_972346_B5615D25 X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-efi , Alexander Graf , Heinrich Schuchardt , Daniel Kiper , Ilias Apalodimas , Matthew Garrett , Peter Jones , Leif Lindholm , Laszlo Ersek , Ard Biesheuvel , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, 9 Feb 2020 at 07:50, Lukas Wunner wrote: > > On Thu, Feb 06, 2020 at 02:03:51PM +0000, Ard Biesheuvel wrote: > > --- a/drivers/firmware/efi/libstub/efistub.h > > +++ b/drivers/firmware/efi/libstub/efistub.h > > @@ -566,6 +566,14 @@ union efi_load_file_protocol { > > } mixed_mode; > > }; > > > > +struct efi_vendor_dev_path { > > + u8 type; > > + u8 sub_type; > > + u16 length; > > + efi_guid_t vendorguid; > > + u8 vendordata[]; > > +} __packed; > > In commit 46cd4b75cd0e ("efi: Add device path parser") I introduced a > struct efi_dev_path with a union for the type-specific data. Maybe > you can make use of it instead of introducing a new type? > That would make sense, but how do you take the size then? Perhaps it would be better to have a generic struct definition for the shared fields, struct definitions for the different types that use the generic type as the first fields, and a separate union that ties them altogether for the parser. > > > --- a/drivers/firmware/efi/libstub/efi-stub-helper.c > > +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c > > @@ -323,3 +323,68 @@ void efi_char16_printk(efi_char16_t *str) > > efi_call_proto(efi_table_attr(efi_system_table(), con_out), > > output_string, str); > > } > > + > > +static const struct { > > + struct efi_vendor_dev_path vendor; > > + struct efi_generic_dev_path end; > > +} __packed initrd_devpath = { > > Nit: Can we consistently stick to "dev_path" in lieu of "devpath"? > Sure. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel