[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <340462a7-462a-3864-64bd-bdac5b428990@redhat.com>
Date: Thu, 14 Nov 2019 12:31:18 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Jonathan Corbet <corbet@....net>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Peter Jones <pjones@...hat.com>,
Dave Olsthoorn <dave@...aar.me>, x86@...nel.org,
platform-driver-x86@...r.kernel.org, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-input@...r.kernel.org
Subject: Re: [PATCH v7 1/8] efi: Export boot-services code and data as
debugfs-blobs
Hi,
On 14-10-2019 11:11, Luis Chamberlain wrote:
> On Fri, Oct 04, 2019 at 04:50:49PM +0200, Hans de Goede wrote:
>> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
>> index 8d3e778e988b..abba49c4c46d 100644
>> --- a/drivers/firmware/efi/efi.c
>> +++ b/drivers/firmware/efi/efi.c
>> @@ -314,6 +315,55 @@ static __init int efivar_ssdt_load(void)
>> static inline int efivar_ssdt_load(void) { return 0; }
>> #endif
>>
>> +#ifdef CONFIG_DEBUG_FS
>> +
>> +#define EFI_DEBUGFS_MAX_BLOBS 32
>> +
>> +static struct debugfs_blob_wrapper debugfs_blob[EFI_DEBUGFS_MAX_BLOBS];
>> +
>> +static void __init efi_debugfs_init(void)
>> +{
>> + struct dentry *efi_debugfs;
>> + efi_memory_desc_t *md;
>> + char name[32];
>> + int type_count[EFI_BOOT_SERVICES_DATA + 1] = {};
>> + int i = 0;
>> +
>> + efi_debugfs = debugfs_create_dir("efi", NULL);
>> + if (IS_ERR_OR_NULL(efi_debugfs))
>> + return;
>> +
>> + for_each_efi_memory_desc(md) {
>> + switch (md->type) {
>> + case EFI_BOOT_SERVICES_CODE:
>> + snprintf(name, sizeof(name), "boot_services_code%d",
>> + type_count[md->type]++);
>> + break;
>> + case EFI_BOOT_SERVICES_DATA:
>> + snprintf(name, sizeof(name), "boot_services_data%d",
>> + type_count[md->type]++);
>> + break;
>> + default:
>> + continue;
>> + }
>> +
>> + debugfs_blob[i].size = md->num_pages << EFI_PAGE_SHIFT;
>> + debugfs_blob[i].data = memremap(md->phys_addr,
>> + debugfs_blob[i].size,
>> + MEMREMAP_WB);
>> + if (!debugfs_blob[i].data)
>> + continue;
>> +
>> + debugfs_create_blob(name, 0400, efi_debugfs, &debugfs_blob[i]);
>> + i++;
>> + if (i == EFI_DEBUGFS_MAX_BLOBS)
>> + break;
>
> Why do we silently ignore more entries ?
A valid remark, I agree that adding a pr_warn_once here would be good
I will do so for the next version.
> And could documentation be
> added for ways in which this could be used in practice?
I can write a little how to use this to get an embedded firmware,
I will add this to firmware/fallback-mechanisms.rst for the next
version.
Regards,
Hans
Powered by blists - more mailing lists