All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel@daenzer.net>
To: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/8] drm/amdgpu: add helper function to query psp runtime db entry (v2)
Date: Wed, 30 Jun 2021 13:08:29 +0200	[thread overview]
Message-ID: <a73c6d35-edb0-d2b5-e98a-778e132f7b4b@daenzer.net> (raw)
In-Reply-To: <1623395146-2162-6-git-send-email-Hawking.Zhang@amd.com>

On 2021-06-11 9:05 a.m., Hawking Zhang wrote:
> PSP will dump various boot up information into a
> portion of local frame buffer, called runtime database.
> The helper function is used for driver to query those
> shared information.
> 
> v2: init ret and check !ret to exit loop as soon as
> found the entry
> 
> Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
> Reviewed-by: John Clements <john.clements@amd.com>
> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 68 +++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index ab4e89186186..dc786c91ec9d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -164,6 +164,74 @@ static int psp_memory_training_init(struct psp_context *psp)
>  	return ret;
>  }
>  
> +/*
> + * Helper funciton to query psp runtime database entry
> + *
> + * @adev: amdgpu_device pointer
> + * @entry_type: the type of psp runtime database entry
> + * @db_entry: runtime database entry pointer
> + *
> + * Return false if runtime database doesn't exit or entry is invalid
> + * or true if the specific database entry is found, and copy to @db_entry
> + */
> +static bool psp_get_runtime_db_entry(struct amdgpu_device *adev,
> +				     enum psp_runtime_entry_type entry_type,
> +				     void *db_entry)
> +{
> +	uint64_t db_header_pos, db_dir_pos;
> +	struct psp_runtime_data_header db_header = {0};
> +	struct psp_runtime_data_directory db_dir = {0};
> +	bool ret = false;
> +	int i;
> +
> +	db_header_pos = adev->gmc.mc_vram_size - PSP_RUNTIME_DB_OFFSET;
> +	db_dir_pos = db_header_pos + sizeof(struct psp_runtime_data_header);
> +
> +	/* read runtime db header from vram */
> +	amdgpu_device_vram_access(adev, db_header_pos, (uint32_t *)&db_header,
> +			sizeof(struct psp_runtime_data_header), false);
> +
> +	if (db_header.cookie != PSP_RUNTIME_DB_COOKIE_ID) {
> +		/* runtime db doesn't exist, exit */
> +		dev_warn(adev->dev, "PSP runtime database doesn't exist\n");
> +		return false;
> +	}

I just noticed this message in the output of

 dmesg -l emerg,alert,crit,err,warn

I wonder if these messages really need to be printed by default at all, let alone at warning level. Do they indicate an issue which needs to be addressed?


> +	/* read runtime database entry from vram */
> +	amdgpu_device_vram_access(adev, db_dir_pos, (uint32_t *)&db_dir,
> +			sizeof(struct psp_runtime_data_directory), false);
> +
> +	if (db_dir.entry_count >= PSP_RUNTIME_DB_DIAG_ENTRY_MAX_COUNT) {
> +		/* invalid db entry count, exit */
> +		dev_warn(adev->dev, "Invalid PSP runtime database entry count\n");
> +		return false;
> +	}


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-06-30 11:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  7:05 [PATCH 1/8] drm/amdgpu: update psp gfx i/f to support dynamic GECC Hawking Zhang
2021-06-11  7:05 ` [PATCH 2/8] drm/amdgpu: allow different boot configs Hawking Zhang
2021-06-11  7:05 ` [PATCH 3/8] drm/amdgpu: add helper function to query gecc status in boot config Hawking Zhang
2021-06-11  7:05 ` [PATCH 4/8] drm/amdgpu: enable dynamic GECC support (v2) Hawking Zhang
2021-06-11  7:05 ` [PATCH 5/8] drm/amdgpu: add psp runtime db structures Hawking Zhang
2021-06-11  7:05 ` [PATCH 6/8] drm/amdgpu: add helper function to query psp runtime db entry (v2) Hawking Zhang
2021-06-30 11:08   ` Michel Dänzer [this message]
2021-06-11  7:05 ` [PATCH 7/8] drm/amdgpu: cache psp runtime boot_cfg_bitmask in sw_int Hawking Zhang
2021-06-11  7:05 ` [PATCH 8/8] drm/amdgpu: disable DRAM memory training when GECC is enabled Hawking Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a73c6d35-edb0-d2b5-e98a-778e132f7b4b@daenzer.net \
    --to=michel@daenzer.net \
    --cc=Hawking.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.