lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20071017.024812.11596022.anemo@mba.ocn.ne.jp>
Date:	Wed, 17 Oct 2007 02:48:12 +0900 (JST)
From:	Atsushi Nemoto <anemo@....ocn.ne.jp>
To:	jason.wessel@...driver.com
Cc:	linux-kernel@...r.kernel.org, ralf@...ux-mips.org
Subject: Re: [PATCH 9/21] KGDB: This adds basic support to the MIPS
 architecture

On Mon, 15 Oct 2007 13:33:07 -0500, Jason Wessel <jason.wessel@...driver.com> wrote:
> --- /dev/null
> +++ b/drivers/serial/serial_txx9_kgdb.c
> @@ -0,0 +1,152 @@

Thank you for attempting to mainline it.  I have some cosmetic comments.

> +static inline unsigned int sio_in(struct uart_port *port, int offset)
> +{
> +	return *(volatile u32 *)(port->membase + offset);
> +}
> +
> +static inline void sio_out(struct uart_port *port, int offset,
> +	unsigned int value)
> +{
> +	*(volatile u32 *)(port->membase + offset) = value;
> +}

It would be better to avoid volatile.

static inline unsigned int sio_in(struct uart_port *port, int offset)
{
	return __raw_readl(port->membase + offset);
}

static inline void sio_out(struct uart_port *port, int offset,
	unsigned int value)
{
	__raw_writel(value, port->membase + offset);
}

> +	/* Reset the UART. */
> +	sio_out(kgdb_port, TXX9_SIFCR, TXX9_SIFCR_SWRST);
> +#ifdef CONFIG_CPU_TX49XX
> +	/*
> +	 * TX4925 BUG WORKAROUND.  Accessing SIOC register
> +	 * immediately after soft reset causes bus error.
> +	 */
> +	iob();
> +	udelay(1);
> +#endif
> +	/* Wait until reset is complete. */
> +	while (sio_in(kgdb_port, TXX9_SIFCR) & TXX9_SIFCR_SWRST);

A while ago, this part of serial_txx9.c was changed a bit (no ifdefs,
avoid endless loop).  Could you change it to:

	unsigned int tmout = 10000;

	sio_out(kgdb_port, TXX9_SIFCR, TXX9_SIFCR_SWRST);
	/* TX4925 BUG WORKAROUND.  Accessing SIOC register
	 * immediately after soft reset causes bus error. */
	mmiowb();
	udelay(1);
	while ((sio_in(kgdb_port, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout)
		udelay(1);

> +	/* Select the input clock prescaler that fits the baud rate. */
> +	quot = (kgdb_port->uartclk + 8 * kgdb_txx9_baud) /
> +		(16 * kgdb_txx9_baud);

uart_get_divisor() can be used here:

	quot = uart_get_divisor(kgdb_port, kgdb_txx9_baud);

> +	if (quot < (256 << 1))
> +		sibgr = (quot >> 1) | TXX9_SIBGR_BCLK_T0;
> +	else if (quot < ( 256 << 3))
> +		sibgr = (quot >> 3) | TXX9_SIBGR_BCLK_T2;
> +	else if (quot < ( 256 << 5))
> +		sibgr = (quot >> 5) | TXX9_SIBGR_BCLK_T4;
> +	else if (quot < ( 256 << 7))
> +		sibgr = (quot >> 7) | TXX9_SIBGR_BCLK_T6;
> +	else
> +		sibgr = 0xff | TXX9_SIBGR_BCLK_T6;

It would be better to do it more similar to serial_txx9.c:

	quot >>= 1;
	if (quot < 256)
		sibgr = quot | TXX9_SIBGR_BCLK_T0;
	else if (quot < (256 << 2))
		sibgr = (quot >> 2) | TXX9_SIBGR_BCLK_T2;
	else if (quot < (256 << 4))
		sibgr = (quot >> 4) | TXX9_SIBGR_BCLK_T4;
	else if (quot < (256 << 6))
		sibgr = (quot >> 6) | TXX9_SIBGR_BCLK_T6;
	else
		sibgr = 0xff | TXX9_SIBGR_BCLK_T6;

---
Atsushi Nemoto
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ