All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Lv Zheng <lv.zheng@intel.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	qemu-arm@nongnu.org, Shannon Zhao <shannon.zhao@linaro.org>,
	Lv Zheng <zetalog@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-arm] [PATCH] debugcon: Add -debugport option to allow changing debug console port number
Date: Sun, 7 Aug 2016 09:00:50 +0300	[thread overview]
Message-ID: <20160807085907-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <24044757332cd427e378053739e6f49980e0ac5d.1470392366.git.lv.zheng@intel.com>

On Fri, Aug 05, 2016 at 06:19:39PM +0800, Lv Zheng wrote:
> Changing debugcon port to 0x402 allows the seabios AML table pre-defined
> DBUG() control method to be able to dump the AML debugging information to
> the re-directed debugging console.
> 
> If the debug port number is configurable, users can further specify a
> proper IO port number for it to make external BIOS's debugging
> facility functioning.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>

This doesn't look like a reasonable interface.

How will user know which io ports are safe to use,
to avoid e.g. conflicts with pci devices?



> ---
>  hw/char/debugcon.c      |    4 ++++
>  hw/i386/acpi-build.c    |    3 ++-
>  include/sysemu/sysemu.h |    1 +
>  qemu-options.hx         |    9 +++++++++
>  vl.c                    |   15 +++++++++++++++
>  5 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
> index e7f025e..f966a09 100644
> --- a/hw/char/debugcon.c
> +++ b/hw/char/debugcon.c
> @@ -105,6 +105,10 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)
>          error_propagate(errp, err);
>          return;
>      }
> +    if (debug_port != 0xe9) {
> +        qdev_prop_set_uint32(dev, "iobase", debug_port);
> +        qdev_prop_set_uint32(dev, "readback", debug_port);
> +    }
>      memory_region_init_io(&s->io, OBJECT(dev), &debugcon_ops, s,
>                            TYPE_ISA_DEBUGCON_DEVICE, 1);
>      memory_region_add_subregion(isa_address_space_io(d),
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index a26a4bb..14c6224 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1442,7 +1442,8 @@ static void build_dbg_aml(Aml *table)
>      Aml *idx = aml_local(2);
>  
>      aml_append(scope,
> -       aml_operation_region("DBG", AML_SYSTEM_IO, aml_int(0x0402), 0x01));
> +       aml_operation_region("DBG", AML_SYSTEM_IO,
> +                            aml_int(debug_port), 0x01));
>      field = aml_field("DBG", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>      aml_append(field, aml_named_field("DBGB", 8));
>      aml_append(scope, field);
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index ee7c760..9e0a30b 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -167,6 +167,7 @@ extern uint8_t qemu_extra_params_fw[2];
>  extern QEMUClockType rtc_clock;
>  extern const char *mem_path;
>  extern int mem_prealloc;
> +extern uint32_t debug_port;
>  
>  #define MAX_NODES 128
>  #define NUMA_NODE_UNASSIGNED MAX_NODES
> diff --git a/qemu-options.hx b/qemu-options.hx
> index a71aaf8..05aedce 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3123,6 +3123,15 @@ The default device is @code{vc} in graphical mode and @code{stdio} in
>  non graphical mode.
>  ETEXI
>  
> +DEF("debugport", HAS_ARG, QEMU_OPTION_debugport, \
> +    "-debugport n     Specify debug IO port number\n",
> +    QEMU_ARCH_ALL)
> +STEXI
> +@item -debugport @var{n}
> +@findex -debugport
> +Specify the debug IO port number, default is 0xe9.
> +ETEXI
> +
>  DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
>      "-pidfile file   write PID to 'file'\n", QEMU_ARCH_ALL)
>  STEXI
> diff --git a/vl.c b/vl.c
> index e7c2c62..710e14d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -178,6 +178,7 @@ bool boot_strict;
>  uint8_t *boot_splash_filedata;
>  size_t boot_splash_filedata_size;
>  uint8_t qemu_extra_params_fw[2];
> +uint32_t debug_port = 0xe9;
>  
>  int icount_align_option;
>  
> @@ -2584,6 +2585,17 @@ static int debugcon_parse(const char *devname)
>      return 0;
>  }
>  
> +static void debugcon_parse_port(const char *arg)
> +{
> +    uint32_t port;
> +
> +    port = strtoul(arg, NULL, 0);
> +    if (port) {
> +        printf("Re-assign debug console to port 0x%08x.\n", port);
> +        debug_port = port;
> +    }
> +}
> +
>  static gint machine_class_cmp(gconstpointer a, gconstpointer b)
>  {
>      const MachineClass *mc1 = a, *mc2 = b;
> @@ -3580,6 +3592,9 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_debugcon:
>                  add_device_config(DEV_DEBUGCON, optarg);
>                  break;
> +            case QEMU_OPTION_debugport:
> +                debugcon_parse_port(optarg);
> +                break;
>              case QEMU_OPTION_loadvm:
>                  loadvm = optarg;
>                  break;
> -- 
> 1.7.10

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Lv Zheng <lv.zheng@intel.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	Shannon Zhao <shannon.zhao@linaro.org>,
	Lv Zheng <zetalog@gmail.com>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] debugcon: Add -debugport option to allow changing debug console port number
Date: Sun, 7 Aug 2016 09:00:50 +0300	[thread overview]
Message-ID: <20160807085907-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <24044757332cd427e378053739e6f49980e0ac5d.1470392366.git.lv.zheng@intel.com>

On Fri, Aug 05, 2016 at 06:19:39PM +0800, Lv Zheng wrote:
> Changing debugcon port to 0x402 allows the seabios AML table pre-defined
> DBUG() control method to be able to dump the AML debugging information to
> the re-directed debugging console.
> 
> If the debug port number is configurable, users can further specify a
> proper IO port number for it to make external BIOS's debugging
> facility functioning.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>

This doesn't look like a reasonable interface.

How will user know which io ports are safe to use,
to avoid e.g. conflicts with pci devices?



> ---
>  hw/char/debugcon.c      |    4 ++++
>  hw/i386/acpi-build.c    |    3 ++-
>  include/sysemu/sysemu.h |    1 +
>  qemu-options.hx         |    9 +++++++++
>  vl.c                    |   15 +++++++++++++++
>  5 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
> index e7f025e..f966a09 100644
> --- a/hw/char/debugcon.c
> +++ b/hw/char/debugcon.c
> @@ -105,6 +105,10 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)
>          error_propagate(errp, err);
>          return;
>      }
> +    if (debug_port != 0xe9) {
> +        qdev_prop_set_uint32(dev, "iobase", debug_port);
> +        qdev_prop_set_uint32(dev, "readback", debug_port);
> +    }
>      memory_region_init_io(&s->io, OBJECT(dev), &debugcon_ops, s,
>                            TYPE_ISA_DEBUGCON_DEVICE, 1);
>      memory_region_add_subregion(isa_address_space_io(d),
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index a26a4bb..14c6224 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1442,7 +1442,8 @@ static void build_dbg_aml(Aml *table)
>      Aml *idx = aml_local(2);
>  
>      aml_append(scope,
> -       aml_operation_region("DBG", AML_SYSTEM_IO, aml_int(0x0402), 0x01));
> +       aml_operation_region("DBG", AML_SYSTEM_IO,
> +                            aml_int(debug_port), 0x01));
>      field = aml_field("DBG", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>      aml_append(field, aml_named_field("DBGB", 8));
>      aml_append(scope, field);
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index ee7c760..9e0a30b 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -167,6 +167,7 @@ extern uint8_t qemu_extra_params_fw[2];
>  extern QEMUClockType rtc_clock;
>  extern const char *mem_path;
>  extern int mem_prealloc;
> +extern uint32_t debug_port;
>  
>  #define MAX_NODES 128
>  #define NUMA_NODE_UNASSIGNED MAX_NODES
> diff --git a/qemu-options.hx b/qemu-options.hx
> index a71aaf8..05aedce 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3123,6 +3123,15 @@ The default device is @code{vc} in graphical mode and @code{stdio} in
>  non graphical mode.
>  ETEXI
>  
> +DEF("debugport", HAS_ARG, QEMU_OPTION_debugport, \
> +    "-debugport n     Specify debug IO port number\n",
> +    QEMU_ARCH_ALL)
> +STEXI
> +@item -debugport @var{n}
> +@findex -debugport
> +Specify the debug IO port number, default is 0xe9.
> +ETEXI
> +
>  DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
>      "-pidfile file   write PID to 'file'\n", QEMU_ARCH_ALL)
>  STEXI
> diff --git a/vl.c b/vl.c
> index e7c2c62..710e14d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -178,6 +178,7 @@ bool boot_strict;
>  uint8_t *boot_splash_filedata;
>  size_t boot_splash_filedata_size;
>  uint8_t qemu_extra_params_fw[2];
> +uint32_t debug_port = 0xe9;
>  
>  int icount_align_option;
>  
> @@ -2584,6 +2585,17 @@ static int debugcon_parse(const char *devname)
>      return 0;
>  }
>  
> +static void debugcon_parse_port(const char *arg)
> +{
> +    uint32_t port;
> +
> +    port = strtoul(arg, NULL, 0);
> +    if (port) {
> +        printf("Re-assign debug console to port 0x%08x.\n", port);
> +        debug_port = port;
> +    }
> +}
> +
>  static gint machine_class_cmp(gconstpointer a, gconstpointer b)
>  {
>      const MachineClass *mc1 = a, *mc2 = b;
> @@ -3580,6 +3592,9 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_debugcon:
>                  add_device_config(DEV_DEBUGCON, optarg);
>                  break;
> +            case QEMU_OPTION_debugport:
> +                debugcon_parse_port(optarg);
> +                break;
>              case QEMU_OPTION_loadvm:
>                  loadvm = optarg;
>                  break;
> -- 
> 1.7.10

  parent reply	other threads:[~2016-08-07  6:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 10:19 [Qemu-devel] [PATCH] debugcon: Add -debugport option to allow changing debug console port number Lv Zheng
2016-08-05 10:19 ` Lv Zheng
2016-08-05 10:57 ` [Qemu-arm] " Igor Mammedov
2016-08-05 10:57   ` Igor Mammedov
2016-08-05 21:47   ` [Qemu-arm] " Zheng, Lv
2016-08-05 21:47     ` Zheng, Lv
2016-08-05 12:15 ` [Qemu-arm] " Paolo Bonzini
2016-08-05 12:15   ` [Qemu-devel] " Paolo Bonzini
2016-08-05 21:48   ` [Qemu-arm] " Zheng, Lv
2016-08-05 21:48     ` [Qemu-devel] " Zheng, Lv
2016-08-07  6:00 ` Michael S. Tsirkin [this message]
2016-08-07  6:00   ` Michael S. Tsirkin
2016-08-08  1:36   ` [Qemu-arm] " Zheng, Lv
2016-08-08  1:36     ` [Qemu-devel] " Zheng, Lv
2016-08-08  7:26 ` [Qemu-arm] [PATCH v2] ACPI: Enable AML DBUG() control method Lv Zheng
2016-08-08  7:26   ` [Qemu-devel] " Lv Zheng
2016-08-08  9:02   ` [Qemu-arm] " Paolo Bonzini
2016-08-08  9:02     ` [Qemu-devel] " Paolo Bonzini
2016-08-08  9:30   ` [Qemu-arm] " Igor Mammedov
2016-08-08  9:30     ` Igor Mammedov

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=20160807085907-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lv.zheng@intel.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    --cc=zetalog@gmail.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 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.