mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Denis OSTERLAND <denis.osterland@diehl.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [PATCH v2] hab: Print events on info command.
Date: Wed, 10 Oct 2018 09:51:29 +0200	[thread overview]
Message-ID: <20181010075129.u67xfq247pmn7sfb@pengutronix.de> (raw)
In-Reply-To: <20181005065537.21844-1-Denis.Osterland@diehl.com>

Hi Denis,

On Fri, Oct 05, 2018 at 06:58:04AM +0000, Denis OSTERLAND wrote:
> From: Denis Osterland <Denis.Osterland@diehl.com>
> 
> This patch adds hab_get_status convenience function
> and uses it in hab info command.
> It returns -EIO if MMU is disabled and -ENXIO if no HAB device
> is available.
> 
> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
> ---
> v1 -> v2: use runtime if, as suggested by Andrey Smirnov,
>           add hab_get_status to have hab implementation
>           selection at a central place
> 
>  commands/hab.c |  3 +++
>  include/hab.h  | 15 +++++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/commands/hab.c b/commands/hab.c
> index 0d7ee8e76..af51e73fc 100644
> --- a/commands/hab.c
> +++ b/commands/hab.c
> @@ -72,6 +72,9 @@ static int do_hab(int argc, char *argv[])
>  		else
>  			printf("devel mode\n");
>  
> +		if (hab_get_status() == -EIO)
> +			printf("Disable MMU to access HAB API!\n");
> +
>  		return 0;
>  	}
>  
> diff --git a/include/hab.h b/include/hab.h
> index 78c2b865b..7c2ffab5e 100644
> --- a/include/hab.h
> +++ b/include/hab.h
> @@ -19,6 +19,7 @@
>  #define __HABV4_H
>  
>  #include <errno.h>
> +#include <mach/generic.h>
>  
>  #ifdef CONFIG_HABV4
>  int imx28_hab_get_status(void);
> @@ -43,6 +44,20 @@ static inline int imx25_hab_get_status(void)
>  }
>  #endif
>  
> +static inline int hab_get_status(void)
> +{
> +	if (IS_ENABLED(CONFIG_MMU))
> +		return -EIO;

This restriction makes this patch rather unhandy to use. Internally we
use imx*_hab_get_status() indeed with MMU enabled and it works fine, but
we call it before mmu_init is called. In this state the MMU is enabled
already, but the zero page is not yet set to faulting. So I think the
problem is not the MMU as such, but instead the faulting zero page.

It would be great if we could overcome this issue. One way to do this
would be to add a function pair mmu_zero_page_map() and
mmu_zero_page_set_faulting() to be called in hab_get_status().

I don't know if you are willing to add that, but I don't want to
motivate people to disable the MMU, so the patch is not acceptable as
is.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-10-10  7:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04  7:05 [PATCH] " Denis OSTERLAND
2018-10-04 21:14 ` Andrey Smirnov
2018-10-05  6:58 ` [PATCH v2] " Denis OSTERLAND
2018-10-10  7:51   ` Sascha Hauer [this message]
2018-10-10  9:29     ` Denis OSTERLAND
2018-10-12  6:23     ` Marc Kleine-Budde
2018-10-15  8:41       ` Denis OSTERLAND
2018-10-15  8:46         ` Marc Kleine-Budde

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=20181010075129.u67xfq247pmn7sfb@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=denis.osterland@diehl.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox